Commit 4fccbc82 authored by kinuko@chromium.org's avatar kinuko@chromium.org

SyncFS: Handle HTTP_CONFLICT as Precondition error

DriveService seems to return HTTP_CONFLICT when precondition error
is returned from Drive. (At least for Upload)

BUG=none
TEST=manual

Review URL: https://codereview.chromium.org/101223003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238393 0039d316-1c4b-4281-b951-d872f2087c98
parent b5966066
......@@ -204,7 +204,8 @@ void ConflictResolver::RemoveNonPrimaryFiles(
void ConflictResolver::DidRemoveFile(const SyncStatusCallback& callback,
const std::string& file_id,
google_apis::GDataErrorCode error) {
if (error == google_apis::HTTP_PRECONDITION) {
if (error == google_apis::HTTP_PRECONDITION ||
error == google_apis::HTTP_CONFLICT) {
callback.Run(SYNC_STATUS_RETRY);
return;
}
......
......@@ -335,15 +335,16 @@ void LocalToRemoteSyncer::DidDeleteRemoteFile(
google_apis::GDataErrorCode error) {
if (error != google_apis::HTTP_SUCCESS &&
error != google_apis::HTTP_NOT_FOUND &&
error != google_apis::HTTP_PRECONDITION) {
error != google_apis::HTTP_PRECONDITION &&
error != google_apis::HTTP_CONFLICT) {
callback.Run(GDataErrorCodeToSyncStatusCode(error));
return;
}
// Handle NOT_FOUND case as SUCCESS case.
// For PRECONDITION case, the remote file is modified since the last sync
// completed. As our policy for deletion-modification conflict resolution,
// ignore the local deletion.
// For PRECONDITION / CONFLICT case, the remote file is modified since the
// last sync completed. As our policy for deletion-modification conflict
// resolution, ignore the local deletion.
callback.Run(SYNC_STATUS_OK);
}
......@@ -386,7 +387,8 @@ void LocalToRemoteSyncer::DidUploadExistingFile(
google_apis::GDataErrorCode error,
const GURL&,
scoped_ptr<google_apis::ResourceEntry> entry) {
if (error == google_apis::HTTP_PRECONDITION) {
if (error == google_apis::HTTP_PRECONDITION ||
error == google_apis::HTTP_CONFLICT) {
// The remote file has unfetched remote change. Fetch latest metadata and
// update database with it.
// TODO(tzik): Consider adding local side low-priority dirtiness handling to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment