Exit the current folder when not existing in the server any more
[pub/Android/ownCloud.git] / src / com / owncloud / android / operations / SynchronizeFolderOperation.java
index a50bf95..7f22bb7 100644 (file)
@@ -293,6 +293,13 @@ public class SynchronizeFolderOperation extends RemoteOperation {
                 }
                 
             } else {
+                if (status == HttpStatus.SC_NOT_FOUND) {
+                    OCFile dir = mStorageManager.getFileByPath(mRemotePath);
+                    if (dir != null) {
+                        String currentSavePath = FileStorageUtils.getSavePath(mAccount.name);
+                        mStorageManager.removeFile(dir, (dir.isDown() && dir.getStoragePath().startsWith(currentSavePath)));
+                    }
+                }
                 result = new RemoteOperationResult(false, status, query.getResponseHeaders());
             }