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); assert(item.type == ItemType.dir);
if (exists(path)) { if (exists(path)) {
if (!isDir(path)) { // Fix https://github.com/abraunegg/onedrive/issues/1915
log.vlog("The item was a directory but now it is a file"); try {
uploadDeleteItem(item, path); if (!isDir(path)) {
uploadNewFile(path); log.vlog("The item was a directory but now it is a file");
} else { uploadDeleteItem(item, path);
log.vlog("The directory has not changed"); uploadNewFile(path);
// loop through the children } else {
foreach (Item child; itemdb.selectChildren(item.driveId, item.id)) { log.vlog("The directory has not changed");
uploadDifferences(child); // 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 { } else {
// Directory does not exist locally // Directory does not exist locally