Fix resolve vs realpath

pull/3/head
Zef Hemel 2022-05-01 17:20:38 +00:00
parent 098a419ff3
commit 2b4d5a0543
3 changed files with 18 additions and 1 deletions

16
package-lock.json generated
View File

@ -21,6 +21,7 @@
"@parcel/validator-typescript": "2.3.2", "@parcel/validator-typescript": "2.3.2",
"parcel": "2.3.2", "parcel": "2.3.2",
"prettier": "^2.5.1", "prettier": "^2.5.1",
"process": "^0.11.10",
"ts-node": "^10.7.0", "ts-node": "^10.7.0",
"typescript": "^4.6.2" "typescript": "^4.6.2"
} }
@ -8126,6 +8127,15 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1" "url": "https://github.com/chalk/ansi-styles?sponsor=1"
} }
}, },
"node_modules/process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
"integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=",
"dev": true,
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/process-nextick-args": { "node_modules/process-nextick-args": {
"version": "2.0.1", "version": "2.0.1",
"license": "MIT" "license": "MIT"
@ -15215,6 +15225,12 @@
} }
} }
}, },
"process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
"integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=",
"dev": true
},
"process-nextick-args": { "process-nextick-args": {
"version": "2.0.1" "version": "2.0.1"
}, },

View File

@ -25,6 +25,7 @@
"@parcel/validator-typescript": "2.3.2", "@parcel/validator-typescript": "2.3.2",
"parcel": "2.3.2", "parcel": "2.3.2",
"prettier": "^2.5.1", "prettier": "^2.5.1",
"process": "^0.11.10",
"ts-node": "^10.7.0", "ts-node": "^10.7.0",
"typescript": "^4.6.2" "typescript": "^4.6.2"
}, },

View File

@ -23,7 +23,7 @@ export class DiskSpacePrimitives implements SpacePrimitives {
} }
safePath(p: string): string { safePath(p: string): string {
let realPath = realpathSync(p); let realPath = path.resolve(p);
if (!realPath.startsWith(this.rootPath)) { if (!realPath.startsWith(this.rootPath)) {
throw Error(`Path ${p} is not in the space`); throw Error(`Path ${p} is not in the space`);
} }