mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-20 14:46:35 +02:00
* Resolve application crash if file is locked by online editing (status code 423)
This commit is contained in:
parent
9e971410ee
commit
4667ecad12
29
src/sync.d
29
src/sync.d
|
@ -836,6 +836,17 @@ final class SyncEngine
|
||||||
try {
|
try {
|
||||||
response = onedrive.simpleUploadReplace(path, item.driveId, item.id, item.eTag);
|
response = onedrive.simpleUploadReplace(path, item.driveId, item.id, item.eTag);
|
||||||
} catch (OneDriveException e) {
|
} catch (OneDriveException e) {
|
||||||
|
// Resolve https://github.com/abraunegg/onedrive/issues/36
|
||||||
|
if ((e.httpStatusCode == 409) || (e.httpStatusCode == 423)) {
|
||||||
|
// The file is currently checked out or locked for editing by another user
|
||||||
|
// We cant upload this file at this time
|
||||||
|
writeln(" skipped.");
|
||||||
|
log.fileOnly("Uploading file ", path, " ... skipped.");
|
||||||
|
write("", 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.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.httpStatusCode == 504) {
|
if (e.httpStatusCode == 504) {
|
||||||
// HTTP request returned status code 504 (Gateway Timeout)
|
// HTTP request returned status code 504 (Gateway Timeout)
|
||||||
// Try upload as a session
|
// Try upload as a session
|
||||||
|
@ -852,7 +863,23 @@ final class SyncEngine
|
||||||
} else {
|
} else {
|
||||||
// OneDrive Business Account - always use a session to upload
|
// OneDrive Business Account - always use a session to upload
|
||||||
writeln("");
|
writeln("");
|
||||||
response = session.upload(path, item.driveId, item.parentId, baseName(path));
|
|
||||||
|
try {
|
||||||
|
response = session.upload(path, item.driveId, item.parentId, baseName(path));
|
||||||
|
} catch (OneDriveException e) {
|
||||||
|
|
||||||
|
// Resolve https://github.com/abraunegg/onedrive/issues/36
|
||||||
|
if ((e.httpStatusCode == 409) || (e.httpStatusCode == 423)) {
|
||||||
|
// The file is currently checked out or locked for editing by another user
|
||||||
|
// We cant upload this file at this time
|
||||||
|
writeln(" skipped.");
|
||||||
|
log.fileOnly("Uploading file ", path, " ... skipped.");
|
||||||
|
writeln("", 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.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
writeln(" done.");
|
writeln(" done.");
|
||||||
// As the session.upload includes the last modified time, save the response
|
// As the session.upload includes the last modified time, save the response
|
||||||
saveItem(response);
|
saveItem(response);
|
||||||
|
|
Loading…
Reference in a new issue