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

Function isInternalFileUrl

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

Source from the content-addressed store, hash-verified

554 * would break self-hosted and multi-domain deployments.
555 */
556export function isInternalFileUrl(fileUrl: string): boolean {
557 if (typeof fileUrl !== 'string') {
558 return false
559 }
560
561 let path = fileUrl
562 const scheme = /^[a-z][a-z0-9+.-]*:\/\/[^/?#]*/i.exec(path)
563 if (scheme) {
564 path = path.slice(scheme[0].length)
565 }
566 path = path.split(/[?#]/, 1)[0]
567
568 return path.startsWith('/api/files/serve/')
569}
570
571/**
572 * Infer storage context from a file key using its prefix.

Callers 15

parser.tsFile · 0.90
parser.tsFile · 0.90
parser.tsFile · 0.90
parser.tsFile · 0.90
hasRecoverableFileKeyFunction · 0.90
handleFileForOCRFunction · 0.90
file-schemas.tsFile · 0.90
resolveFileInputToUrlFunction · 0.90
downloadFileFromUrlFunction · 0.90
resolveInternalFileUrlFunction · 0.90
file-utils.test.tsFile · 0.90
route.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected