diff --git a/packages/bruno-electron/src/ipc/collection.js b/packages/bruno-electron/src/ipc/collection.js index 07f15926f..89138f090 100644 --- a/packages/bruno-electron/src/ipc/collection.js +++ b/packages/bruno-electron/src/ipc/collection.js @@ -20,7 +20,6 @@ const { normalizeWslPath, normalizeAndResolvePath, safeToRename, - sanitizeCollectionName, isWindowsOS, isValidFilename, hasSubDirectories, @@ -76,7 +75,6 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection async (event, collectionName, collectionFolderName, collectionLocation) => { try { collectionFolderName = sanitizeDirectoryName(collectionFolderName); - collectionName = sanitizeCollectionName(collectionName); const dirPath = path.join(collectionLocation, collectionFolderName); if (fs.existsSync(dirPath)) { const files = fs.readdirSync(dirPath); @@ -118,7 +116,7 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection ipcMain.handle( 'renderer:clone-collection', async (event, collectionName, collectionFolderName, collectionLocation, previousPath) => { - collectionFolderName = sanitizeCollectionName(collectionFolderName); + collectionFolderName = sanitizeDirectoryName(collectionFolderName); const dirPath = path.join(collectionLocation, collectionFolderName); if (fs.existsSync(dirPath)) { throw new Error(`collection: ${dirPath} already exists`); @@ -168,7 +166,6 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection // rename collection ipcMain.handle('renderer:rename-collection', async (event, newName, collectionPathname) => { try { - newName = sanitizeCollectionName(newName); const brunoJsonFilePath = path.join(collectionPathname, 'bruno.json'); const content = fs.readFileSync(brunoJsonFilePath, 'utf8'); const json = JSON.parse(content); @@ -521,7 +518,7 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection ipcMain.handle('renderer:import-collection', async (event, collection, collectionLocation) => { try { - let collectionName = sanitizeCollectionName(collection.name); + let collectionName = sanitizeDirectoryName(collection.name); let collectionPath = path.join(collectionLocation, collectionName); if (fs.existsSync(collectionPath)) { diff --git a/packages/bruno-electron/src/utils/filesystem.js b/packages/bruno-electron/src/utils/filesystem.js index 0a849f055..a9c8597e7 100644 --- a/packages/bruno-electron/src/utils/filesystem.js +++ b/packages/bruno-electron/src/utils/filesystem.js @@ -154,10 +154,6 @@ const searchForBruFiles = (dir) => { return searchForFiles(dir, '.bru'); }; -const sanitizeCollectionName = (name) => { - return name.trim(); -} - const sanitizeDirectoryName = (name) => { return name.replace(/[<>:"/\\|?*\x00-\x1F]+/g, '-').trim(); }; @@ -267,7 +263,6 @@ module.exports = { searchForFiles, searchForBruFiles, sanitizeDirectoryName, - sanitizeCollectionName, isWindowsOS, safeToRename, isValidFilename,