mirror of
https://github.com/usebruno/bruno.git
synced 2025-02-22 20:51:23 +01:00
* fix: implement custom pathname validation #2193 * fix: update pathname validation to use basename for directory checks * fix: improve error message for invalid pathname in collection.js
This commit is contained in:
parent
a6ac98b709
commit
086c4c063e
@ -76,9 +76,8 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
|
||||
throw new Error(`collection: ${dirPath} already exists and is not empty`);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isValidPathname(dirPath)) {
|
||||
throw new Error(`collection: invalid pathname - ${dir}`);
|
||||
if (!isValidPathname(path.basename(dirPath))) {
|
||||
throw new Error(`collection: invalid pathname - ${dirPath}`);
|
||||
}
|
||||
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
@ -111,8 +110,8 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
|
||||
throw new Error(`collection: ${dirPath} already exists`);
|
||||
}
|
||||
|
||||
if (!isValidPathname(dirPath)) {
|
||||
throw new Error(`collection: invalid pathname - ${dir}`);
|
||||
if (!isValidPathname(path.basename(dirPath))) {
|
||||
throw new Error(`collection: invalid pathname - ${dirPath}`);
|
||||
}
|
||||
|
||||
// create dir
|
||||
|
Loading…
Reference in New Issue
Block a user