Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
fix(backend:files): correct directory flag and ensure consistent file move operation in trash handling
johavene85ead7e7f8a
diff --git a/backend/src/applications/files/services/files-manager.service.ts b/backend/src/applications/files/services/files-manager.service.tsindex ccd2966a..3a9915ca 100644--- a/backend/src/applications/files/services/files-manager.service.ts+++ b/backend/src/applications/files/services/files-manager.service.ts@@ -427,14 +427,12 @@ export class FilesManager {// move the resource in dbconst trashFileDB: FileDBProps = { ...space.dbFile, inTrash: true }const dstTrashFileDB: FileDBProps = { ...trashFileDB, path: path.join(dirName(trashFileDB.path), fileName(dstTrash.path)) }- this.filesQueries- .moveFiles(trashFileDB, dstTrashFileDB, dstTrash.isDir)- .catch((e: Error) => this.logger.error(`${this.delete.name} - ${e}`))+ await this.filesQueries.moveFiles(trashFileDB, dstTrashFileDB, dstTrash.isDir)}await moveFiles(space.realPath, trashFile, true)} else {- this.logger.log(`Unable to find trash path for space - *${space.alias}* (${space.id}) : delete permanently : ${space.realPath}`)- // todo: define a default trash for external paths+ // unsupported case: delete the file (this shouldn't happen)+ this.logger.error(`Unable to find trash path for space - *${space.alias}* (${space.id}) : delete permanently : ${space.realPath}`)forceDeleteInDB = trueawait removeFiles(space.realPath)}diff --git a/backend/src/applications/files/utils/files.ts b/backend/src/applications/files/utils/files.tsindex 847ead86..85d9ffa2 100644--- a/backend/src/applications/files/utils/files.ts+++ b/backend/src/applications/files/utils/files.ts@@ -263,7 +263,7 @@ export async function uniqueDatedFilePath(rPath: string): Promise<{ isDir: boole} else {const extension = path.extname(rPath)const nameWithoutExtension = path.basename(rPath, extension)- return { isDir: true, path: path.join(path.dirname(rPath), `${nameWithoutExtension}-${date}${extension}`) }+ return { isDir: false, path: path.join(path.dirname(rPath), `${nameWithoutExtension}-${date}${extension}`) }}}