Skip to content
Snippets Groups Projects
Commit e208074e authored by timothycarambat's avatar timothycarambat
Browse files

patch path normalization

parent e2439c6d
No related branches found
No related tags found
No related merge requests found
......@@ -122,7 +122,7 @@ function isWithin(outer, inner) {
function normalizePath(filepath = "") {
const result = path
.normalize(filepath.trim())
.normalize(filepath.replace(/\s/g, "-").trim())
.replace(/^(\.\.(\/|\\|$))+/, "")
.trim();
if (["..", ".", "/"].includes(result)) throw new Error("Invalid path.");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment