MCPcopy Index your code
hub / github.com/codeaashu/claude-code / parseFileSpecs

Function parseFileSpecs

src/services/api/filesApi.ts:722–748  ·  view source on GitHub ↗
(fileSpecs: string[])

Source from the content-addressed store, hash-verified

720 * @returns Parsed file attachments
721 */
722export function parseFileSpecs(fileSpecs: string[]): File[] {
723 const files: File[] = []
724
725 // Sandbox-gateway may pass multiple specs as a single space-separated string
726 const expandedSpecs = fileSpecs.flatMap(s => s.split(' ').filter(Boolean))
727
728 for (const spec of expandedSpecs) {
729 const colonIndex = spec.indexOf(':')
730 if (colonIndex === -1) {
731 continue
732 }
733
734 const fileId = spec.substring(0, colonIndex)
735 const relativePath = spec.substring(colonIndex + 1)
736
737 if (!fileId || !relativePath) {
738 logDebugError(
739 `Invalid file spec: ${spec}. Both file_id and path are required`,
740 )
741 continue
742 }
743
744 files.push({ fileId, relativePath })
745 }
746
747 return files
748}
749

Callers 1

runFunction · 0.85

Calls 2

logDebugErrorFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected