MCPcopy Create free account
hub / github.com/deta/surf / fetchFilePath

Function fetchFilePath

app/src/main/surfProtocolHandlers.ts:374–389  ·  view source on GitHub ↗
(base: string, filePath: string)

Source from the content-addressed store, hash-verified

372}
373
374const fetchFilePath = async (base: string, filePath: string) => {
375 try {
376 if (!isPathSafe(base, filePath)) {
377 return {
378 response: new Response('Forbidden', { status: 403 }),
379 filePath,
380 base
381 }
382 }
383
384 const response = await net.fetch(`file://${filePath}`)
385 return { response, filePath, base }
386 } catch (error) {
387 return null
388 }
389}
390
391const migrateResourceFile = async (
392 legacyFilePath: string,

Callers 1

fetchResourceFileFunction · 0.85

Calls 2

isPathSafeFunction · 0.90
fetchMethod · 0.80

Tested by

no test coverage detected