X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/c0c52fa16a79f6be71ffbe7c7cb587af67335793..1e59a632bcedc56845e6494f244e79d76a1f8b8a:/src/com/owncloud/android/files/services/FileUploader.java diff --git a/src/com/owncloud/android/files/services/FileUploader.java b/src/com/owncloud/android/files/services/FileUploader.java index 445274c4..14909344 100644 --- a/src/com/owncloud/android/files/services/FileUploader.java +++ b/src/com/owncloud/android/files/services/FileUploader.java @@ -590,8 +590,18 @@ public class FileUploader extends Service } finally { Log_OC.v("NOW " + TAG + ", thread " + Thread.currentThread().getName(), "Removing payload " + mCurrentUpload.getRemotePath()); - Pair removeResult = - mPendingUploads.removePayload(mCurrentAccount, mCurrentUpload.getRemotePath()); + Pair removeResult; + if (mCurrentUpload.wasRenamed()) { + removeResult = mPendingUploads.removePayload( + mCurrentAccount, + mCurrentUpload.getOldFile().getRemotePath() + ); + } else { + removeResult = mPendingUploads.removePayload( + mCurrentAccount, + mCurrentUpload.getRemotePath() + ); + } /// notify result notifyUploadResult(mCurrentUpload, uploadResult); @@ -670,7 +680,7 @@ public class FileUploader extends Service * synchronized with the server, specially the modification time and Etag * (where available) * - * TODO refactor this ugly thing + * TODO move into UploadFileOperation */ private void saveUploadedFile() { OCFile file = mCurrentUpload.getFile(); @@ -688,6 +698,8 @@ public class FileUploader extends Service if (result.isSuccess()) { updateOCFile(file, (RemoteFile) result.getData().get(0)); file.setLastSyncDateForProperties(syncDate); + } else { + Log_OC.e(TAG, "Error reading properties of file after successful upload; this is gonna hurt..."); } // / maybe this would be better as part of UploadFileOperation... or @@ -697,6 +709,7 @@ public class FileUploader extends Service if (oldFile.fileExists()) { oldFile.setStoragePath(null); mStorageManager.saveFile(oldFile); + mStorageManager.saveConflict(oldFile, false); } // else: it was just an automatic renaming due to a name // coincidence; nothing else is needed, the storagePath is right @@ -704,6 +717,7 @@ public class FileUploader extends Service } file.setNeedsUpdateThumbnail(true); mStorageManager.saveFile(file); + mStorageManager.saveConflict(file, false); } private void updateOCFile(OCFile file, RemoteFile remoteFile) { @@ -712,7 +726,7 @@ public class FileUploader extends Service file.setMimetype(remoteFile.getMimeType()); file.setModificationTimestamp(remoteFile.getModifiedTimestamp()); file.setModificationTimestampAtLastSyncForData(remoteFile.getModifiedTimestamp()); - // file.setEtag(remoteFile.getEtag()); // TODO Etag, where available + file.setEtag(remoteFile.getEtag()); file.setRemoteId(remoteFile.getRemoteId()); }