From e615b9a20dddd051736afcfaaaa8ce8f5408bffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Gonz=C3=A1lez=20Cabrero?= Date: Fri, 15 Apr 2016 14:18:57 +0200 Subject: [PATCH] Fix deleted file update in media scanner --- .../android/operations/UploadFileOperation.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/com/owncloud/android/operations/UploadFileOperation.java b/src/com/owncloud/android/operations/UploadFileOperation.java index 4cd70e384d..65519afe29 100644 --- a/src/com/owncloud/android/operations/UploadFileOperation.java +++ b/src/com/owncloud/android/operations/UploadFileOperation.java @@ -379,16 +379,15 @@ public class UploadFileOperation extends SyncOperation { mFile.setStoragePath(""); } else { mFile.setStoragePath(expectedPath); - File fileToMove; + if (temporalFile != null) { // FileUploader.LOCAL_BEHAVIOUR_COPY - fileToMove = temporalFile; + move(temporalFile, expectedFile); } else { // FileUploader.LOCAL_BEHAVIOUR_MOVE - fileToMove = originalFile; + move(originalFile, expectedFile); + getStorageManager().deleteFileInMediaScan(originalFile.getAbsolutePath()); } - move(fileToMove, expectedFile); + FileDataStorageManager.triggerMediaScan(expectedFile.getAbsolutePath()); } - FileDataStorageManager.triggerMediaScan(originalFile.getAbsolutePath()); - FileDataStorageManager.triggerMediaScan(expectedFile.getAbsolutePath()); } else if (result.getHttpCode() == HttpStatus.SC_PRECONDITION_FAILED ) { result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT);