mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2025-04-17 18:18:11 +00:00
patch path normalization
This commit is contained in:
parent
e2439c6d4c
commit
e208074ef4
1 changed files with 1 additions and 1 deletions
|
@ -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.");
|
||||
|
|
Loading…
Add table
Reference in a new issue