fix trashedFilePath returning relative path issue

This commit is contained in:
Abhinav 2023-05-03 19:34:01 +05:30
parent ab50f27d87
commit b3f9c1a1b4

View file

@ -245,14 +245,15 @@ export const getTrashedFileExportPath = (exportDir: string, path: string) => {
let trashedFilePath = `${exportDir}/${ENTE_TRASH_FOLDER}/${fileRelativePath}`; let trashedFilePath = `${exportDir}/${ENTE_TRASH_FOLDER}/${fileRelativePath}`;
let count = 1; let count = 1;
while (exportService.exists(trashedFilePath)) { while (exportService.exists(trashedFilePath)) {
const filenameParts = splitFilenameAndExtension(fileRelativePath); const trashedFilePathParts = splitFilenameAndExtension(trashedFilePath);
if (filenameParts[1]) { if (trashedFilePathParts[1]) {
trashedFilePath = `${filenameParts[0]}(${count}).${filenameParts[1]}`; trashedFilePath = `${trashedFilePathParts[0]}(${count}).${trashedFilePathParts[1]}`;
} else { } else {
trashedFilePath = `${filenameParts[0]}(${count})`; trashedFilePath = `${trashedFilePathParts[0]}(${count})`;
} }
count++; count++;
} }
console.log('trashedFilePath', trashedFilePath);
return trashedFilePath; return trashedFilePath;
}; };