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

Function hasRecoverableFileKey

apps/sim/lib/workflows/input-format.ts:71–79  ·  view source on GitHub ↗

* Whether a file's key is usable at run time: an explicit non-empty `key`, or an * internal `/api/files/serve/...` URL the key can actually be parsed from. This * mirrors `normalizeStartFile` exactly (including the parse, so a malformed * internal URL is rejected rather than accepted on the prefi

(file: InputFormatFile)

Source from the content-addressed store, hash-verified

69 * internal URL is rejected rather than accepted on the prefix alone).
70 */
71function hasRecoverableFileKey(file: InputFormatFile): boolean {
72 if (typeof file.key === 'string' && file.key.length > 0) return true
73 if (typeof file.url !== 'string' || !isInternalFileUrl(file.url)) return false
74 try {
75 return parseInternalFileUrl(file.url).key.length > 0
76 } catch {
77 return false
78 }
79}
80
81/**
82 * Tolerantly parses a file field's stored value (a JSON string, or an already

Callers 1

parseInputFormatFilesFunction · 0.85

Calls 2

isInternalFileUrlFunction · 0.90
parseInternalFileUrlFunction · 0.90

Tested by

no test coverage detected