MCPcopy Index your code
hub / github.com/simstudioai/sim / resolveFilePath

Function resolveFilePath

apps/sim/tools/file/parser.ts:222–241  ·  view source on GitHub ↗
(fileInput: unknown)

Source from the content-addressed store, hash-verified

220 const determinedFileType: string | undefined = params.fileType
221
222 const resolveFilePath = (fileInput: unknown): string | null => {
223 if (!isRecord(fileInput)) return null
224
225 if (typeof fileInput.path === 'string') {
226 return fileInput.path
227 }
228
229 if (typeof fileInput.url === 'string') {
230 return fileInput.url
231 }
232
233 if (typeof fileInput.key === 'string') {
234 const key = fileInput.key
235 const context =
236 typeof fileInput.context === 'string' ? fileInput.context : inferContextFromKey(key)
237 return `/api/files/serve/${encodeURIComponent(key)}?context=${context}`
238 }
239
240 return null
241 }
242
243 // Determine the file path(s) based on input parameters.
244 // Precedence: direct filePath > file array > single file object > legacy files array

Callers 1

parser.tsFile · 0.85

Calls 2

inferContextFromKeyFunction · 0.90
isRecordFunction · 0.70

Tested by

no test coverage detected