mirror of
https://github.com/usebruno/bruno.git
synced 2025-02-17 18:20:53 +01:00
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) * :
This commit is contained in:
parent
1f17d39a91
commit
a1719a33fc
@ -16,6 +16,7 @@ const {
|
|||||||
sanitizeDirectoryName,
|
sanitizeDirectoryName,
|
||||||
isWSLPath,
|
isWSLPath,
|
||||||
normalizeWslPath,
|
normalizeWslPath,
|
||||||
|
normalizeAndResolvePath
|
||||||
} = require('../utils/filesystem');
|
} = require('../utils/filesystem');
|
||||||
const { openCollectionDialog } = require('../app/collections');
|
const { openCollectionDialog } = require('../app/collections');
|
||||||
const { generateUidBasedOnHash, stringifyJson, safeParseJSON, safeStringifyJSON } = require('../utils/common');
|
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) => {
|
ipcMain.handle('renderer:rename-item', async (event, oldPath, newPath, newName) => {
|
||||||
try {
|
try {
|
||||||
// Normalize paths if they are WSL paths
|
// Normalize paths if they are WSL paths
|
||||||
if (isWSLPath(oldPath)) {
|
oldPath = isWSLPath(oldPath) ? normalizeWslPath(oldPath) : normalizeAndResolvePath(oldPath);
|
||||||
oldPath = normalizeWslPath(oldPath);
|
newPath = isWSLPath(newPath) ? normalizeWslPath(newPath) : normalizeAndResolvePath(newPath);
|
||||||
}
|
|
||||||
if (isWSLPath(newPath)) {
|
|
||||||
newPath = normalizeWslPath(newPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fs.existsSync(oldPath)) {
|
if (!fs.existsSync(oldPath)) {
|
||||||
throw new Error(`path: ${oldPath} does not exist`);
|
throw new Error(`path: ${oldPath} does not exist`);
|
||||||
|
Loading…
Reference in New Issue
Block a user