Fix crash when trying to sync broken symbolic link (#1917)

* Check the response for directory checks as to if it generates a file exception error
This commit is contained in:
abraunegg 2022-04-08 05:50:47 +10:00 committed by GitHub
parent 5d320505c7
commit 29b0ef0b98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3469,16 +3469,23 @@ final class SyncEngine
{
assert(item.type == ItemType.dir);
if (exists(path)) {
if (!isDir(path)) {
log.vlog("The item was a directory but now it is a file");
uploadDeleteItem(item, path);
uploadNewFile(path);
} else {
log.vlog("The directory has not changed");
// loop through the children
foreach (Item child; itemdb.selectChildren(item.driveId, item.id)) {
uploadDifferences(child);
// Fix https://github.com/abraunegg/onedrive/issues/1915
try {
if (!isDir(path)) {
log.vlog("The item was a directory but now it is a file");
uploadDeleteItem(item, path);
uploadNewFile(path);
} else {
log.vlog("The directory has not changed");
// loop through the children
foreach (Item child; itemdb.selectChildren(item.driveId, item.id)) {
uploadDifferences(child);
}
}
} catch (FileException e) {
// display the error message
displayFileSystemErrorMessage(e.msg, getFunctionName!({}));
return;
}
} else {
// Directory does not exist locally