Selaa lähdekoodia

wip

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 6 vuotta sitten
vanhempi
commit
9927a649dc

+ 1 - 1
src/generic/java/com/owncloud/android/utils/PushUtils.java

@@ -1,4 +1,4 @@
-/*
+/**
  * Nextcloud Android client application
  *
  * @author Mario Danic

+ 12 - 7
src/main/java/com/owncloud/android/operations/UploadFileOperation.java

@@ -692,11 +692,15 @@ public class UploadFileOperation extends SyncOperation {
             if (!unlockFolderResult.isSuccess()) {
                 return unlockFolderResult;
             }
-
         } else if (result.getCode() == ResultCode.SYNC_CONFLICT) {
             getStorageManager().saveConflict(mFile, mFile.getEtagInConflict());
         }
 
+        // delete temporal file
+        if (temporalFile != null && temporalFile.exists() && !temporalFile.delete()) {
+            Log_OC.e(TAG, "Could not delete temporal file " + temporalFile.getAbsolutePath());
+        }
+
         return result;
     }
 
@@ -894,6 +898,11 @@ public class UploadFileOperation extends SyncOperation {
             getStorageManager().saveConflict(mFile, mFile.getEtagInConflict());
         }
 
+        // delete temporal file
+        if (temporalFile != null && temporalFile.exists() && !temporalFile.delete()) {
+            Log_OC.e(TAG, "Could not delete temporal file " + temporalFile.getAbsolutePath());
+        }
+
         return result;
     }
 
@@ -902,7 +911,8 @@ public class UploadFileOperation extends SyncOperation {
         RemoteOperationResult result = null;
 
         if (mLocalBehaviour == FileUploader.LOCAL_BEHAVIOUR_COPY && !mOriginalStoragePath.equals(expectedPath)) {
-            String temporalPath = FileStorageUtils.getInternalTemporalPath(mAccount.name, mContext) + mFile.getRemotePath();
+            String temporalPath = FileStorageUtils.getInternalTemporalPath(mAccount.name, mContext) +
+                mFile.getRemotePath();
             mFile.setStoragePath(temporalPath);
             File temporalFile = new File(temporalPath);
 
@@ -979,11 +989,6 @@ public class UploadFileOperation extends SyncOperation {
                 FileDataStorageManager.triggerMediaScan(newFile.getAbsolutePath());
                 break;
         }
-
-        // delete temporal file
-        String temporalPath = FileStorageUtils.getInternalTemporalPath(mAccount.name, mContext) + mFile.getRemotePath();
-        temporalFile = new File(temporalPath);
-        temporalFile.delete();
     }
 
     /**