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 count = 1;
while (exportService.exists(trashedFilePath)) {
const filenameParts = splitFilenameAndExtension(fileRelativePath);
if (filenameParts[1]) {
trashedFilePath = `${filenameParts[0]}(${count}).${filenameParts[1]}`;
const trashedFilePathParts = splitFilenameAndExtension(trashedFilePath);
if (trashedFilePathParts[1]) {
trashedFilePath = `${trashedFilePathParts[0]}(${count}).${trashedFilePathParts[1]}`;
} else {
trashedFilePath = `${filenameParts[0]}(${count})`;
trashedFilePath = `${trashedFilePathParts[0]}(${count})`;
}
count++;
}
console.log('trashedFilePath', trashedFilePath);
return trashedFilePath;
};