mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-01 13:32:16 +02:00
Fix an unhandled Error 412 when uploading modified files to OneDrive Business Accounts (#1394)
* Update error 412 handling when uploading modified files to OneDrive Business Accounts
This commit is contained in:
parent
97a468e606
commit
615aa05b42
26
src/sync.d
26
src/sync.d
|
@ -3425,7 +3425,7 @@ final class SyncEngine
|
||||||
// HTTP request returned status code 412 - ETag does not match current item's value
|
// HTTP request returned status code 412 - ETag does not match current item's value
|
||||||
// Delete record from the local database - file will be uploaded as a new file
|
// Delete record from the local database - file will be uploaded as a new file
|
||||||
writeln("skipped.");
|
writeln("skipped.");
|
||||||
log.vdebug("Simple Upload Replace Failed - OneDrive eTag / cTag match issue");
|
log.vdebug("Simple Upload Replace Failed - OneDrive eTag / cTag match issue (Personal Account)");
|
||||||
log.vlog("OneDrive returned a 'HTTP 412 - Precondition Failed' - gracefully handling error. Will upload as new file.");
|
log.vlog("OneDrive returned a 'HTTP 412 - Precondition Failed' - gracefully handling error. Will upload as new file.");
|
||||||
itemdb.deleteById(item.driveId, item.id);
|
itemdb.deleteById(item.driveId, item.id);
|
||||||
uploadFailed = true;
|
uploadFailed = true;
|
||||||
|
@ -3468,7 +3468,7 @@ final class SyncEngine
|
||||||
// HTTP request returned status code 412 - ETag does not match current item's value
|
// HTTP request returned status code 412 - ETag does not match current item's value
|
||||||
// Delete record from the local database - file will be uploaded as a new file
|
// Delete record from the local database - file will be uploaded as a new file
|
||||||
writeln("skipped.");
|
writeln("skipped.");
|
||||||
log.vdebug("Simple Upload Replace Failed - OneDrive eTag / cTag match issue");
|
log.vdebug("Session Upload Replace Failed - OneDrive eTag / cTag match issue (Personal Account)");
|
||||||
log.vlog("OneDrive returned a 'HTTP 412 - Precondition Failed' - gracefully handling error. Will upload as new file.");
|
log.vlog("OneDrive returned a 'HTTP 412 - Precondition Failed' - gracefully handling error. Will upload as new file.");
|
||||||
itemdb.deleteById(item.driveId, item.id);
|
itemdb.deleteById(item.driveId, item.id);
|
||||||
uploadFailed = true;
|
uploadFailed = true;
|
||||||
|
@ -3539,6 +3539,16 @@ final class SyncEngine
|
||||||
log.fileOnly(path, " is currently checked out or locked for editing by another user.");
|
log.fileOnly(path, " is currently checked out or locked for editing by another user.");
|
||||||
uploadFailed = true;
|
uploadFailed = true;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
if (e.httpStatusCode == 412) {
|
||||||
|
// HTTP request returned status code 412 - ETag does not match current item's value
|
||||||
|
// Delete record from the local database - file will be uploaded as a new file
|
||||||
|
writeln("skipped.");
|
||||||
|
log.vdebug("Session Upload Replace Failed - OneDrive eTag / cTag match issue (Business Account)");
|
||||||
|
log.vlog("OneDrive returned a 'HTTP 412 - Precondition Failed' - gracefully handling error. Will upload as new file.");
|
||||||
|
itemdb.deleteById(item.driveId, item.id);
|
||||||
|
uploadFailed = true;
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
// display what the error is
|
// display what the error is
|
||||||
writeln("skipped.");
|
writeln("skipped.");
|
||||||
|
@ -3727,7 +3737,7 @@ final class SyncEngine
|
||||||
log.vlog("OneDrive returned a 'HTTP 401 - Unauthorized' - gracefully handling error");
|
log.vlog("OneDrive returned a 'HTTP 401 - Unauthorized' - gracefully handling error");
|
||||||
uploadFailed = true;
|
uploadFailed = true;
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
// Resolve https://github.com/abraunegg/onedrive/issues/36
|
// Resolve https://github.com/abraunegg/onedrive/issues/36
|
||||||
if ((e.httpStatusCode == 409) || (e.httpStatusCode == 423)) {
|
if ((e.httpStatusCode == 409) || (e.httpStatusCode == 423)) {
|
||||||
// The file is currently checked out or locked for editing by another user
|
// The file is currently checked out or locked for editing by another user
|
||||||
|
@ -3738,6 +3748,16 @@ final class SyncEngine
|
||||||
log.fileOnly(path, " is currently checked out or locked for editing by another user.");
|
log.fileOnly(path, " is currently checked out or locked for editing by another user.");
|
||||||
uploadFailed = true;
|
uploadFailed = true;
|
||||||
return response;
|
return response;
|
||||||
|
}
|
||||||
|
if (e.httpStatusCode == 412) {
|
||||||
|
// HTTP request returned status code 412 - ETag does not match current item's value
|
||||||
|
// Delete record from the local database - file will be uploaded as a new file
|
||||||
|
writeln("skipped.");
|
||||||
|
log.vdebug("Session Upload Replace Failed - OneDrive eTag / cTag match issue (Sharepoint Library)");
|
||||||
|
log.vlog("OneDrive returned a 'HTTP 412 - Precondition Failed' - gracefully handling error. Will upload as new file.");
|
||||||
|
itemdb.deleteById(item.driveId, item.id);
|
||||||
|
uploadFailed = true;
|
||||||
|
return response;
|
||||||
} else {
|
} else {
|
||||||
// display what the error is
|
// display what the error is
|
||||||
writeln("skipped.");
|
writeln("skipped.");
|
||||||
|
|
Loading…
Reference in a new issue