MCPcopy
hub / github.com/simstudioai/sim / parseInternalFileUrl

Function parseInternalFileUrl

apps/sim/lib/uploads/utils/file-utils.ts:604–617  ·  view source on GitHub ↗
(fileUrl: string)

Source from the content-addressed store, hash-verified

602 * @returns Object with storage key and context
603 */
604export 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

Callers 2

hasRecoverableFileKeyFunction · 0.90
normalizeStartFileFunction · 0.90

Calls 3

extractStorageKeyFunction · 0.85
inferContextFromKeyFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected