MCPcopy Create free account
hub / github.com/cloudflare/computer / resolveMountPath

Function resolveMountPath

examples/worker-javascript/src/index.ts:34–41  ·  view source on GitHub ↗
(rest: string)

Source from the content-addressed store, hash-verified

32const MOUNT_ROOT = "/workspace";
33
34function resolveMountPath(rest: string): string | null {
35 const candidate = `/${rest}`;
36 if (candidate !== MOUNT_ROOT && !candidate.startsWith(`${MOUNT_ROOT}/`)) {
37 return null;
38 }
39 if (candidate.split("/").includes("..")) return null;
40 return candidate;
41}
42
43export default {
44 async fetch(request: Request, env: Env): Promise<Response> {

Callers 1

fetchFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected