} finally {
Log_OC.v("NOW " + TAG + ", thread " + Thread.currentThread().getName(),
"Removing payload " + mCurrentUpload.getRemotePath());
- Pair<UploadFileOperation, String> removeResult =
- mPendingUploads.removePayload(mCurrentAccount, mCurrentUpload.getRemotePath());
+ Pair<UploadFileOperation, String> removeResult;
+ if (mCurrentUpload.wasRenamed()) {
+ removeResult = mPendingUploads.removePayload(
+ mCurrentAccount,
+ mCurrentUpload.getOldFile().getRemotePath()
+ );
+ } else {
+ removeResult = mPendingUploads.removePayload(
+ mCurrentAccount,
+ mCurrentUpload.getRemotePath()
+ );
+ }
/// notify result
notifyUploadResult(mCurrentUpload, uploadResult);
* 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();
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
}
file.setNeedsUpdateThumbnail(true);
mStorageManager.saveFile(file);
+ mStorageManager.saveConflict(file, false);
}
private void updateOCFile(OCFile file, RemoteFile remoteFile) {