(rest: string)
| 32 | const MOUNT_ROOT = "/workspace"; |
| 33 | |
| 34 | function 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 | |
| 43 | export default { |
| 44 | async fetch(request: Request, env: Env): Promise<Response> { |