updated translations
[pub/Android/ownCloud.git] / src / eu / alefzero / owncloud / datamodel / FileDataStorageManager.java
index c732f59..b6fa918 100644 (file)
@@ -111,11 +111,12 @@ public class FileDataStorageManager implements DataStorageManager {
         cv.put(ProviderTableMeta.FILE_KEEP_IN_SYNC, file.keepInSync() ? 1 : 0);
 
         if (fileExists(file.getRemotePath())) {
-            OCFile tmpfile = getFileByPath(file.getRemotePath());
-            file.setStoragePath(tmpfile.getStoragePath());
+            OCFile oldFile = getFileByPath(file.getRemotePath());
+            if (file.getStoragePath() == null && oldFile.getStoragePath() != null)
+                file.setStoragePath(oldFile.getStoragePath());
             if (!file.isDirectory());
                 cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
-            file.setFileId(tmpfile.getFileId());
+            file.setFileId(oldFile.getFileId());
 
             overriden = true;
             if (getContentResolver() != null) {
@@ -412,7 +413,7 @@ public class FileDataStorageManager implements DataStorageManager {
                                         ProviderTableMeta.FILE_ACCOUNT_OWNER+"=?",
                                         new String[]{mAccount.name});
         }
-        if (file.getStoragePath() != null) {
+        if (file.isDown()) {
             new File(file.getStoragePath()).delete();
         }
     }