From 400df010e76e24fd0ee1f8d07e6f802cd163784a Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Tue, 3 Oct 2023 11:06:57 +0200 Subject: [PATCH 1/3] fix file move issue due to relative path --- .../foundation/e/drive/operations/DownloadFileOperation.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/drive/operations/DownloadFileOperation.java b/app/src/main/java/foundation/e/drive/operations/DownloadFileOperation.java index 370e9ede..d5c8d8cc 100644 --- a/app/src/main/java/foundation/e/drive/operations/DownloadFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/DownloadFileOperation.java @@ -178,7 +178,10 @@ public class DownloadFileOperation extends RemoteOperation { try { if (!targetDir.exists()) targetDir.mkdirs(); - final Path copyResult = Files.copy(tmpFile.toPath(), targetFile.toPath(), REPLACE_EXISTING); + final Path targetPath = targetFile.toPath().toAbsolutePath(); + final Path tmpPath = tmpFile.toPath().toAbsolutePath(); + + final Path copyResult = Files.copy(tmpPath, targetPath, REPLACE_EXISTING); if (copyResult.toFile().length() == tmpFile.length()) { tmpFile.delete(); return true; -- GitLab From 94f6f87c14770e971a9b59d1eb911592b75125c4 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Tue, 3 Oct 2023 16:14:45 +0200 Subject: [PATCH 2/3] fix error in parameter at initialization of root folder --- .../foundation/e/drive/work/CreateRemoteFolderWorker.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/foundation/e/drive/work/CreateRemoteFolderWorker.java b/app/src/main/java/foundation/e/drive/work/CreateRemoteFolderWorker.java index 24987dce..d2433950 100644 --- a/app/src/main/java/foundation/e/drive/work/CreateRemoteFolderWorker.java +++ b/app/src/main/java/foundation/e/drive/work/CreateRemoteFolderWorker.java @@ -106,15 +106,15 @@ public class CreateRemoteFolderWorker extends Worker { final Data data = getInputData(); final String category = data.getString(DATA_KEY_LIBELLE); final String remotePath = data.getString(DATA_KEY_REMOTE_PATH); - final String localPath = data.getString(DATA_KEY_REMOTE_PATH); + final String localPath = data.getString(DATA_KEY_LOCAL_PATH); if( category == null || remotePath == null || localPath == null) { return null; } final SyncedFolder result = new SyncedFolder( category, - remotePath, localPath, + remotePath, data.getBoolean(DATA_KEY_SCAN_LOCAL, true), data.getBoolean(DATA_KEY_SCAN_REMOTE, true), data.getBoolean(DATA_KEY_ENABLE, true), -- GitLab From 4ec8f1fc6ba414e00462a169ca8a3fd370f4573a Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Tue, 3 Oct 2023 16:36:39 +0200 Subject: [PATCH 3/3] remove useless usage of 'toAbsolutePath()' from previous commit --- .../e/drive/operations/DownloadFileOperation.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/foundation/e/drive/operations/DownloadFileOperation.java b/app/src/main/java/foundation/e/drive/operations/DownloadFileOperation.java index d5c8d8cc..fcce43f8 100644 --- a/app/src/main/java/foundation/e/drive/operations/DownloadFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/DownloadFileOperation.java @@ -61,7 +61,6 @@ public class DownloadFileOperation extends RemoteOperation { * @param syncedFileState SyncedFileState corresponding to remote file */ public DownloadFileOperation(@NonNull RemoteFile remoteFile, @NonNull SyncedFileState syncedFileState, @NonNull Context context) { - Timber.tag(DownloadFileOperation.class.getSimpleName()); this.remoteFile = remoteFile; this.syncedFileState = syncedFileState; this.previousEtag = syncedFileState.getLastEtag(); @@ -178,9 +177,9 @@ public class DownloadFileOperation extends RemoteOperation { try { if (!targetDir.exists()) targetDir.mkdirs(); - final Path targetPath = targetFile.toPath().toAbsolutePath(); - final Path tmpPath = tmpFile.toPath().toAbsolutePath(); - + final Path targetPath = targetFile.toPath(); + final Path tmpPath = tmpFile.toPath(); + final Path copyResult = Files.copy(tmpPath, targetPath, REPLACE_EXISTING); if (copyResult.toFile().length() == tmpFile.length()) { tmpFile.delete(); -- GitLab