(fileUrl: string)
| 602 | * @returns Object with storage key and context |
| 603 | */ |
| 604 | export function parseInternalFileUrl(fileUrl: string): { key: string; context: StorageContext } { |
| 605 | const key = extractStorageKey(fileUrl) |
| 606 | |
| 607 | if (!key) { |
| 608 | throw new Error('Could not extract storage key from internal file URL') |
| 609 | } |
| 610 | |
| 611 | const url = new URL(fileUrl.startsWith('http') ? fileUrl : `http://localhost${fileUrl}`) |
| 612 | const contextParam = url.searchParams.get('context') |
| 613 | |
| 614 | const context = (contextParam as StorageContext) || inferContextFromKey(key) |
| 615 | |
| 616 | return { key, context } |
| 617 | } |
| 618 | |
| 619 | /** |
| 620 | * Raw file input that can be converted to UserFile |
no test coverage detected