(fileInput: unknown)
| 657 | * Returns null if no valid HTTPS URL is found |
| 658 | */ |
| 659 | export function resolveHttpsUrlFromFileInput(fileInput: unknown): string | null { |
| 660 | if (!fileInput || typeof fileInput !== 'object') { |
| 661 | return null |
| 662 | } |
| 663 | |
| 664 | const record = fileInput as Record<string, unknown> |
| 665 | const url = |
| 666 | typeof record.url === 'string' |
| 667 | ? record.url.trim() |
| 668 | : typeof record.path === 'string' |
| 669 | ? record.path.trim() |
| 670 | : '' |
| 671 | |
| 672 | if (!url || !url.startsWith('https://')) { |
| 673 | return null |
| 674 | } |
| 675 | |
| 676 | return url |
| 677 | } |
| 678 | |
| 679 | function resolveStorageKeyFromRawFile(file: RawFileInput): string | null { |
| 680 | if (file.key) { |
no outgoing calls
no test coverage detected