diff --git a/api/src/controllers/drive.ts b/api/src/controllers/drive.ts index 41acb31..36d2127 100644 --- a/api/src/controllers/drive.ts +++ b/api/src/controllers/drive.ts @@ -395,7 +395,7 @@ const deleteFolder = async (folderPath: string) => { throw new Error('Cannot delete file outside drive.') } - if (!(await fileExists(folderPathFull))) { + if (!(await folderExists(folderPathFull))) { throw new Error('Folder does not exist.') } @@ -482,7 +482,7 @@ const rename = async ( if (await fileExists(oldPathFull)) { if (await fileExists(newPathFull)) { throw new Error('File already exists.') - } else moveFile(oldPath, newPathFull) + } else moveFile(oldPathFull, newPathFull) return { status: 'success' } } diff --git a/api/src/utils/getAuthorizedRoutes.ts b/api/src/utils/getAuthorizedRoutes.ts index 93412fa..82f581b 100644 --- a/api/src/utils/getAuthorizedRoutes.ts +++ b/api/src/utils/getAuthorizedRoutes.ts @@ -9,6 +9,7 @@ const StaticAuthorizedRoutes = [ '/SASjsApi/drive/file', '/SASjsApi/drive/folder', '/SASjsApi/drive/fileTree', + '/SASjsApi/drive/rename', '/SASjsApi/permission' ] diff --git a/web/src/components/tree.tsx b/web/src/components/tree.tsx index 8394efe..135a876 100644 --- a/web/src/components/tree.tsx +++ b/web/src/components/tree.tsx @@ -221,19 +221,17 @@ const TreeViewNode = ({ : undefined } > - {node.isFolder && - ['Add Folder', 'Add File'].map((item) => ( + {node.isFolder && ( +