mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-22 15:46:36 +02:00
fixed bug where remotely deleted and recreated directories would make the application crash
This commit is contained in:
parent
9765b27902
commit
22db459ac4
28
src/sync.d
28
src/sync.d
|
@ -212,13 +212,6 @@ final class SyncEngine
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if the item is going to be deleted
|
|
||||||
if (isItemDeleted(jsonItem)) {
|
|
||||||
log.vlog("The item is marked for deletion");
|
|
||||||
idsToDelete ~= [item.driveId, item.id];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check the item type
|
// check the item type
|
||||||
if (isItemRemote(jsonItem)) {
|
if (isItemRemote(jsonItem)) {
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -228,16 +221,31 @@ final class SyncEngine
|
||||||
log.vlog("Remote items are not supported yet");
|
log.vlog("Remote items are not supported yet");
|
||||||
skippedItems ~= item.id;
|
skippedItems ~= item.id;
|
||||||
return;
|
return;
|
||||||
} else if (!isItemFile(jsonItem) && !isItemFolder(jsonItem)) {
|
} else if (!isItemFile(jsonItem) && !isItemFolder(jsonItem) && !isItemDeleted(jsonItem)) {
|
||||||
log.vlog("The item is neither a file nor a directory, skipping");
|
log.vlog("The item is neither a file nor a directory, skipping");
|
||||||
skippedItems ~= item.id;
|
skippedItems ~= item.id;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// rename the local item if it is unsynced and there is a new version of it
|
// check if the item has been seen before
|
||||||
Item oldItem;
|
Item oldItem;
|
||||||
string oldPath;
|
|
||||||
bool cached = itemdb.selectById(item.driveId, item.id, oldItem);
|
bool cached = itemdb.selectById(item.driveId, item.id, oldItem);
|
||||||
|
|
||||||
|
// check if the item is going to be deleted
|
||||||
|
if (isItemDeleted(jsonItem)) {
|
||||||
|
log.vlog("The item is marked for deletion");
|
||||||
|
if (cached) {
|
||||||
|
// flag to delete
|
||||||
|
idsToDelete ~= [item.driveId, item.id];
|
||||||
|
} else {
|
||||||
|
// flag to ignore
|
||||||
|
skippedItems ~= item.id;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// rename the local item if it is unsynced and there is a new version of it
|
||||||
|
string oldPath;
|
||||||
if (cached && item.eTag != oldItem.eTag) {
|
if (cached && item.eTag != oldItem.eTag) {
|
||||||
oldPath = itemdb.computePath(item.driveId, item.id);
|
oldPath = itemdb.computePath(item.driveId, item.id);
|
||||||
if (!isItemSynced(oldItem, oldPath)) {
|
if (!isItemSynced(oldItem, oldPath)) {
|
||||||
|
|
Loading…
Reference in a new issue