mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 21:25:35 +03:00
Upload operations end in conflict if overriding a version different than the last known
This commit is contained in:
parent
fb482fa33a
commit
001801a39b
3 changed files with 10 additions and 3 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 092c790030ef42b34352225e9c1d8480a0e38674
|
||||
Subproject commit eb4f8a723490a18c5a07fbdc3bf19928c49c4a10
|
|
@ -572,6 +572,9 @@ public class FileUploader extends Service
|
|||
uploadResult = mCurrentUpload.execute(mUploadClient);
|
||||
if (uploadResult.isSuccess()) {
|
||||
saveUploadedFile();
|
||||
|
||||
} else if (uploadResult.getCode() == ResultCode.SYNC_CONFLICT) {
|
||||
mStorageManager.saveConflict(mCurrentUpload.getFile(), true);
|
||||
}
|
||||
} else {
|
||||
uploadResult = grantResult;
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.Iterator;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.httpclient.methods.RequestEntity;
|
||||
|
||||
import android.accounts.Account;
|
||||
|
@ -310,10 +311,10 @@ public class UploadFileOperation extends RemoteOperation {
|
|||
(new File(mFile.getStoragePath())).length() >
|
||||
ChunkedUploadRemoteFileOperation.CHUNK_SIZE ) {
|
||||
mUploadOperation = new ChunkedUploadRemoteFileOperation(mFile.getStoragePath(),
|
||||
mFile.getRemotePath(), mFile.getMimetype());
|
||||
mFile.getRemotePath(), mFile.getMimetype(), mFile.getEtag());
|
||||
} else {
|
||||
mUploadOperation = new UploadRemoteFileOperation(mFile.getStoragePath(),
|
||||
mFile.getRemotePath(), mFile.getMimetype());
|
||||
mFile.getRemotePath(), mFile.getMimetype(), mFile.getEtag());
|
||||
}
|
||||
Iterator <OnDatatransferProgressListener> listener = mDataTransferListeners.iterator();
|
||||
while (listener.hasNext()) {
|
||||
|
@ -358,6 +359,9 @@ public class UploadFileOperation extends RemoteOperation {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (result.getHttpCode() == HttpStatus.SC_PRECONDITION_FAILED ) {
|
||||
result = new RemoteOperationResult(ResultCode.CONFLICT);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
Loading…
Reference in a new issue