From c145f5632a737cd2759300143c8210541b603e66 Mon Sep 17 00:00:00 2001 From: geoffreychen777 Date: Thu, 25 Jul 2024 08:53:22 +0100 Subject: [PATCH] fix: cross device rename --- app/repositories/file-repository/local-backend.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/repositories/file-repository/local-backend.ts b/app/repositories/file-repository/local-backend.ts index 118bd0cc..8fef745a 100644 --- a/app/repositories/file-repository/local-backend.ts +++ b/app/repositories/file-repository/local-backend.ts @@ -91,7 +91,9 @@ export class LocalFileBackend implements IFileBackend { } else if (fileOperation === "copy") { await fsPromise.copyFile(_sourceURL, _targetURL); } else if (fileOperation === "cut") { - await fsPromise.rename(_sourceURL, _targetURL); + // await fsPromise.rename(_sourceURL, _targetURL); + await fsPromise.copyFile(_sourceURL, _targetURL); + await fsPromise.unlink(_sourceURL); } } }