Workaround Google 412 error

This commit is contained in:
benweet 2013-04-13 01:05:59 +01:00
parent 49869fb9d8
commit f410e98886
2 changed files with 3 additions and 7 deletions

View File

@ -161,11 +161,13 @@ define(["jquery", "async-runner"], function($, asyncTaskRunner) {
} }
var error = response.error; var error = response.error;
// Handle error // Handle error
if(error !== undefined && fileId !== undefined && error.code === 404) { if(error !== undefined && fileId !== undefined) {
if(error.code === 404) { if(error.code === 404) {
error = 'File ID "' + fileId + '" does not exist on Google Drive.'; error = 'File ID "' + fileId + '" does not exist on Google Drive.';
} }
else if(error.code === 412) { else if(error.code === 412) {
// We may have missed a file update
localStorage.removeItem("sync.gdrive.lastChangeId");
error = 'Conflict on file ID "' + fileId + '". Please restart the synchronization.'; error = 'Conflict on file ID "' + fileId + '". Please restart the synchronization.';
} }
} }

View File

@ -218,9 +218,6 @@ define(["jquery", "google-helper", "dropbox-helper"], function($, googleHelper,
localStorage[fileSyncIndex + ".etag"] = file.etag; localStorage[fileSyncIndex + ".etag"] = file.etag;
localStorage[fileSyncIndex + ".contentCRC"] = core.crc32(file.content); localStorage[fileSyncIndex + ".contentCRC"] = core.crc32(file.content);
localStorage[fileSyncIndex + ".titleCRC"] = core.crc32(file.title); localStorage[fileSyncIndex + ".titleCRC"] = core.crc32(file.title);
// Synchronize file with others locations
uploadPending = true; // may be unnecessary since syncUp checks content changes
} }
if(updateFileTitles) { if(updateFileTitles) {
fileManager.updateFileTitles(); fileManager.updateFileTitles();
@ -289,9 +286,6 @@ define(["jquery", "google-helper", "dropbox-helper"], function($, googleHelper,
// Update file version and CRC // Update file version and CRC
localStorage[fileSyncIndex + ".version"] = file.versionTag; localStorage[fileSyncIndex + ".version"] = file.versionTag;
localStorage[fileSyncIndex + ".contentCRC"] = core.crc32(file.content); localStorage[fileSyncIndex + ".contentCRC"] = core.crc32(file.content);
// Synchronize file with others locations
uploadPending = true; // may be unnecessary since syncUp checks every changes
} }
if(updateFileTitles) { if(updateFileTitles) {
fileManager.updateFileTitles(); fileManager.updateFileTitles();