Sfoglia il codice sorgente

Fix a bug

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 7 anni fa
parent
commit
8eedca84f7

+ 1 - 1
src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java

@@ -129,7 +129,7 @@ public class FileDataStorageManager {
         c.close();
         return file;
     }
-
+    
     public OCFile getFileByLocalPath(String path) {
         Cursor c = getFileCursorForValue(ProviderTableMeta.FILE_STORAGE_PATH, path);
         OCFile file = null;

+ 9 - 2
src/main/java/com/owncloud/android/files/services/FileUploader.java

@@ -408,10 +408,17 @@ public class FileUploader extends Service
                         currentAccount = failedUpload.getAccount(context);
                     }
 
-                    charging = charging || Device.getBatteryStatus(context).getBatteryPercent() == 1;
-                    if (!isPowerSaving && gotNetwork && checkIfUploadCanBeRetried(failedUpload, gotWifi, charging)) {
+                    if (!new File(failedUpload.getLocalPath()).exists()) {
+                        if (!failedUpload.getLastResult().equals(UploadResult.FILE_NOT_FOUND)) {
+                            failedUpload.setLastResult(UploadResult.FILE_NOT_FOUND);
+                            uploadsStorageManager.updateUpload(failedUpload);
+                        }
+                    } else {
+                        charging = charging || Device.getBatteryStatus(context).getBatteryPercent() == 1;
+                        if (!isPowerSaving && gotNetwork && checkIfUploadCanBeRetried(failedUpload, gotWifi, charging)) {
                             retry(context, currentAccount, failedUpload);
                         }
+                    }
                 }
             }
         }