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

Function decodeVfsSegment

apps/sim/lib/copilot/vfs/path-utils.ts:23–35  ·  view source on GitHub ↗
(segment: string)

Source from the content-addressed store, hash-verified

21}
22
23export function decodeVfsSegment(segment: string): string {
24 try {
25 const decoded = decodeURIComponent(segment)
26 const normalized = normalizeDisplaySegment(decoded)
27 if (!normalized || normalized === '.' || normalized === '..') {
28 throw new VfsPathError('VFS path segment cannot be empty or a dot segment')
29 }
30 return normalized
31 } catch (error) {
32 if (error instanceof VfsPathError) throw error
33 throw new VfsPathError(`Invalid encoded VFS path segment: ${segment}`)
34 }
35}
36
37export function encodeVfsPathSegments(segments: string[]): string {
38 return segments.map(encodeVfsSegment).join('/')

Callers 2

decodeVfsSegmentSafeFunction · 0.90
canonicalUploadKeyFunction · 0.90

Calls 1

normalizeDisplaySegmentFunction · 0.85

Tested by

no test coverage detected