mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-01 21:52:50 +02:00
Resolve itemdb.d(295): Assertion failure
* Resolve core.exception.AssertError@src/itemdb.d(295): Assertion failure when performing a --single-directory sync
This commit is contained in:
parent
41976ed216
commit
9520fe7716
12
src/itemdb.d
12
src/itemdb.d
|
@ -141,6 +141,18 @@ final class ItemDatabase
|
|||
return false;
|
||||
}
|
||||
|
||||
// returns if an item id is in the database
|
||||
bool idInLocalDatabase(const(string) driveId, const(string)id)
|
||||
{
|
||||
selectItemByIdStmt.bind(1, driveId);
|
||||
selectItemByIdStmt.bind(2, id);
|
||||
auto r = selectItemByIdStmt.exec();
|
||||
if (!r.empty) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// returns the item with the given path
|
||||
// the path is relative to the sync directory ex: "./Music/Turbo Killer.mp3"
|
||||
bool selectByPath(const(char)[] path, string rootDriveId, out Item item)
|
||||
|
|
20
src/sync.d
20
src/sync.d
|
@ -389,15 +389,19 @@ final class SyncEngine
|
|||
}
|
||||
// Yes .. ID is still on OneDrive but elsewhere .... #341 edge case handling
|
||||
// What is the original local path for this ID in the database? Does it match 'syncFolderName'
|
||||
string originalLocalPath = itemdb.computePath(driveId, item["id"].str);
|
||||
|
||||
if (canFind(originalLocalPath, syncFolderName)){
|
||||
// This 'change' relates to an item that WAS in 'syncFolderName' but is now
|
||||
// stored elsewhere on OneDrive - outside the path we are syncing from
|
||||
// Remove this item locally as it's local path is now obsolete
|
||||
idsToDelete ~= [driveId, item["id"].str];
|
||||
if (itemdb.idInLocalDatabase(driveId, item["id"].str)){
|
||||
// item is in the database
|
||||
string originalLocalPath = itemdb.computePath(driveId, item["id"].str);
|
||||
if (canFind(originalLocalPath, syncFolderName)){
|
||||
// This 'change' relates to an item that WAS in 'syncFolderName' but is now
|
||||
// stored elsewhere on OneDrive - outside the path we are syncing from
|
||||
// Remove this item locally as it's local path is now obsolete
|
||||
idsToDelete ~= [driveId, item["id"].str];
|
||||
}
|
||||
} else {
|
||||
log.vlog("Remote Change Discarded: ", item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue