(rest: string)
| 86 | const MOUNT_ROOT = "/workspace"; |
| 87 | |
| 88 | function 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 | |
| 97 | export default { |
| 98 | async fetch(request: Request, env: Env): Promise<Response> { |