From 2b4d5a0543f2d35579e675ddfc66fd835cff3a27 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Sun, 1 May 2022 17:20:38 +0000 Subject: [PATCH] Fix resolve vs realpath --- package-lock.json | 16 ++++++++++++++++ package.json | 1 + packages/common/spaces/disk_space_primitives.ts | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index c23240e0..45d6c6b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "@parcel/validator-typescript": "2.3.2", "parcel": "2.3.2", "prettier": "^2.5.1", + "process": "^0.11.10", "ts-node": "^10.7.0", "typescript": "^4.6.2" } @@ -8126,6 +8127,15 @@ "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": { "version": "2.0.1", "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": { "version": "2.0.1" }, diff --git a/package.json b/package.json index 8a337fdd..388ed72e 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@parcel/validator-typescript": "2.3.2", "parcel": "2.3.2", "prettier": "^2.5.1", + "process": "^0.11.10", "ts-node": "^10.7.0", "typescript": "^4.6.2" }, diff --git a/packages/common/spaces/disk_space_primitives.ts b/packages/common/spaces/disk_space_primitives.ts index 76ca0047..3ae6fc53 100644 --- a/packages/common/spaces/disk_space_primitives.ts +++ b/packages/common/spaces/disk_space_primitives.ts @@ -23,7 +23,7 @@ export class DiskSpacePrimitives implements SpacePrimitives { } safePath(p: string): string { - let realPath = realpathSync(p); + let realPath = path.resolve(p); if (!realPath.startsWith(this.rootPath)) { throw Error(`Path ${p} is not in the space`); }