From a1719a33fc78e30f3542c0f00fdd929f2511bf32 Mon Sep 17 00:00:00 2001 From: Pragadesh-45 <54320162+Pragadesh-45@users.noreply.github.com> Date: Thu, 26 Sep 2024 10:15:09 +0530 Subject: [PATCH] Bugfix/rename request open tab not found (#3192) * Refactor: Normalize and resolve paths in renameItem action * Refactor: Normalize and resolve paths in renameItem action (handler side) * : --- packages/bruno-electron/src/ipc/collection.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/bruno-electron/src/ipc/collection.js b/packages/bruno-electron/src/ipc/collection.js index 945c21559..3d1c15ef0 100644 --- a/packages/bruno-electron/src/ipc/collection.js +++ b/packages/bruno-electron/src/ipc/collection.js @@ -16,6 +16,7 @@ const { sanitizeDirectoryName, isWSLPath, normalizeWslPath, + normalizeAndResolvePath } = require('../utils/filesystem'); const { openCollectionDialog } = require('../app/collections'); const { generateUidBasedOnHash, stringifyJson, safeParseJSON, safeStringifyJSON } = require('../utils/common'); @@ -329,12 +330,8 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection ipcMain.handle('renderer:rename-item', async (event, oldPath, newPath, newName) => { try { // Normalize paths if they are WSL paths - if (isWSLPath(oldPath)) { - oldPath = normalizeWslPath(oldPath); - } - if (isWSLPath(newPath)) { - newPath = normalizeWslPath(newPath); - } + oldPath = isWSLPath(oldPath) ? normalizeWslPath(oldPath) : normalizeAndResolvePath(oldPath); + newPath = isWSLPath(newPath) ? normalizeWslPath(newPath) : normalizeAndResolvePath(newPath); if (!fs.existsSync(oldPath)) { throw new Error(`path: ${oldPath} does not exist`);