From ed27e6839b4f2befa4c8fa09571f64330f720a90 Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Wed, 8 Mar 2023 10:57:35 +0600 Subject: [PATCH] 6711-Disable_local_file_deletion_feature issue: https://gitlab.e.foundation/e/backlog/-/issues/6711 Because of corner cases, files got deleted accidentally locally when files are not ever synced in the cloud on the first hand. As a quick-fix, we are disableing the local deletion feature for now. --- .../e/drive/contentScanner/RemoteContentScanner.java | 4 ++++ .../foundation/e/drive/services/SynchronizationService.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/src/main/java/foundation/e/drive/contentScanner/RemoteContentScanner.java b/app/src/main/java/foundation/e/drive/contentScanner/RemoteContentScanner.java index 9ff7c18c..0e8d37ed 100644 --- a/app/src/main/java/foundation/e/drive/contentScanner/RemoteContentScanner.java +++ b/app/src/main/java/foundation/e/drive/contentScanner/RemoteContentScanner.java @@ -82,12 +82,16 @@ public class RemoteContentScanner extends AbstractContentScanner { @Override protected void onMissingFile(SyncedFileState fileState) { + //TODO: disabled file deletion feature for now to handle accidental file deletion. + //Uncomment the following block when we resolve the issue: https://gitlab.e.foundation/e/backlog/-/issues/6711 +/* if (!fileState.hasBeenSynchronizedOnce()) { return; } Timber.d("Add local deletion request for file: %s", fileState.getLocalPath()); this.syncRequests.put(fileState.getId(), new SyncRequest(fileState, LOCAL_DELETE)); +*/ } @Override diff --git a/app/src/main/java/foundation/e/drive/services/SynchronizationService.java b/app/src/main/java/foundation/e/drive/services/SynchronizationService.java index 2ff8733b..74946167 100644 --- a/app/src/main/java/foundation/e/drive/services/SynchronizationService.java +++ b/app/src/main/java/foundation/e/drive/services/SynchronizationService.java @@ -236,12 +236,16 @@ public class SynchronizationService extends Service implements OnRemoteOperation final SyncWrapper syncWrapper = new SyncWrapper(request, account, getApplicationContext()); if (request.getOperationType().equals(SyncRequest.Type.LOCAL_DELETE)) { + //TODO: disabled file deletion feature for now to handle accidental file deletion. + //Uncomment the following block when we resolve the issue: https://gitlab.e.foundation/e/backlog/-/issues/6711 +/* Timber.v(" starts " + request.getSyncedFileState().getName() + " local deletion on thread " + threadIndex); final LocalFileDeleter fileDeleter = new LocalFileDeleter(request.getSyncedFileState()); threadPool[threadIndex] = new Thread(fileDeleter.getRunnable( handler, threadIndex, getApplicationContext(), this)); threadPool[threadIndex].start(); startedSync.put(threadIndex, syncWrapper); +*/ return; } -- GitLab