mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-10 01:36:39 +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 {
|
||||
response = onedrive.simpleUploadReplace(path, item.driveId, item.id, item.eTag);
|
||||
} 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) {
|
||||
// HTTP request returned status code 504 (Gateway Timeout)
|
||||
// Try upload as a session
|
||||
|
@ -852,7 +863,23 @@ final class SyncEngine
|
|||
} else {
|
||||
// OneDrive Business Account - always use a session to upload
|
||||
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.");
|
||||
// As the session.upload includes the last modified time, save the response
|
||||
saveItem(response);
|
||||
|
|
Loading…
Reference in a new issue