mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-10 09:46:40 +02:00
Resolve #356 by adding additional check for 409 response
* Add an additional check for 409 (Conflict) being returned when creating directories even when the directory is only attempted to be created when it cannot be found.
This commit is contained in:
parent
2827467296
commit
18ee4649e0
16
src/sync.d
16
src/sync.d
|
@ -935,8 +935,20 @@ final class SyncEngine
|
|||
];
|
||||
|
||||
// Submit the creation request
|
||||
auto res = onedrive.createById(parent.driveId, parent.id, driveItem);
|
||||
saveItem(res);
|
||||
JSONValue response;
|
||||
// Fix for https://github.com/skilion/onedrive/issues/356
|
||||
try {
|
||||
response = onedrive.createById(parent.driveId, parent.id, driveItem);
|
||||
} catch (OneDriveException e) {
|
||||
if (e.httpStatusCode == 409) {
|
||||
// OneDrive API returned a 404 (above) to say the directory did not exist
|
||||
// but when we attempted to create it, OneDrive responded that it now already exists
|
||||
log.vlog("OneDrive reported that ", path, " already exists .. OneDrive API race condition");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
saveItem(response);
|
||||
log.vlog("Successfully created the remote directory ", path, " on OneDrive");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue