X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/a8fade7369bc8d1752dc4ba5fe07935cac84e96f..ab3bcf6fe6f62add623a60405ef96ea77839f7a4:/src/com/owncloud/android/operations/SynchronizeFolderOperation.java diff --git a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java index b15119a8..7f22bb7a 100644 --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java @@ -276,24 +276,32 @@ public class SynchronizeFolderOperation extends RemoteOperation { } else { client.exhaustResponse(query.getResponseBodyAsStream()); } - } - - // prepare result object - if (!dirChanged) { - result = new RemoteOperationResult(ResultCode.OK_NO_CHANGES_ON_DIR); - mChildren = mStorageManager.getDirectoryContent(mStorageManager.getFileById(mParentId)); - - } else if (isMultiStatus(status)) { - if (mConflictsFound > 0 || mFailsInFavouritesFound > 0) { - result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT); // should be different result, but will do the job + + + // prepare result object + if (!dirChanged) { + result = new RemoteOperationResult(ResultCode.OK_NO_CHANGES_ON_DIR); + mChildren = mStorageManager.getDirectoryContent(mStorageManager.getFileById(mParentId)); } else { - result = new RemoteOperationResult(true, status, query.getResponseHeaders()); + if (mConflictsFound > 0 || mFailsInFavouritesFound > 0) { + result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT); // should be different result, but will do the job + + } else { + result = new RemoteOperationResult(true, status, query.getResponseHeaders()); + } } + } 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()); } - Log_OC.i(TAG, "Synchronizing " + mAccount.name + ", folder " + mRemotePath + ": " + result.getLogMessage()); } catch (Exception e) { result = new RemoteOperationResult(e); @@ -303,12 +311,12 @@ public class SynchronizeFolderOperation extends RemoteOperation { if (query != null) query.releaseConnection(); // let the connection available for other methods if (result.isSuccess()) { - Log_OC.i(TAG, "Synchronizing " + mAccount.name + ", folder " + mRemotePath + ": " + result.getLogMessage()); + Log_OC.i(TAG, "Synchroned " + mAccount.name + ", folder " + mRemotePath + ": " + result.getLogMessage()); } else { if (result.isException()) { - Log_OC.e(TAG, "Synchronizing " + mAccount.name + ", folder " + mRemotePath + ": " + result.getLogMessage(), result.getException()); + Log_OC.e(TAG, "Synchroned " + mAccount.name + ", folder " + mRemotePath + ": " + result.getLogMessage(), result.getException()); } else { - Log_OC.e(TAG, "Synchronizing " + mAccount.name + ", folder " + mRemotePath + ": " + result.getLogMessage()); + Log_OC.e(TAG, "Synchroned " + mAccount.name + ", folder " + mRemotePath + ": " + result.getLogMessage()); } }