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

Function resolveMountPath

examples/worker-shell/src/index.ts:88–95  ·  view source on GitHub ↗
(rest: string)

Source from the content-addressed store, hash-verified

86const MOUNT_ROOT = "/workspace";
87
88function resolveMountPath(rest: string): string | null {
89 const candidate = `/${rest}`;
90 if (candidate !== MOUNT_ROOT && !candidate.startsWith(`${MOUNT_ROOT}/`)) {
91 return null;
92 }
93 if (candidate.split("/").includes("..")) return null;
94 return candidate;
95}
96
97export default {
98 async fetch(request: Request, env: Env): Promise<Response> {

Callers 1

fetchFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected