mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-09 17:26:47 +02:00
Fix 'Item cannot be deleted from OneDrive because it was not found in the local database' (#1354)
* When in --monitor mode, and there are multiple driveId being used (shared folders), when a deletion event occurs, search the DB using all the known driveids rather than just the default one. When using just the default driveid, if the file to be deleted resides on another drive, the following error message is printed: 'Item cannot be deleted from OneDrive because it was not found in the local database' - which is not entirely accurate as the item is in the database, it is just not being searched for correctly.
This commit is contained in:
parent
0dcc76f9f1
commit
6b20478635
|
@ -1043,7 +1043,7 @@ int main(string[] args)
|
|||
log.vlog("Offline, cannot delete item!");
|
||||
} catch(SyncException e) {
|
||||
if (e.msg == "The item to delete is not in the local database") {
|
||||
log.vlog("Item cannot be deleted from OneDrive because not found in the local database");
|
||||
log.vlog("Item cannot be deleted from OneDrive because it was not found in the local database");
|
||||
} else {
|
||||
log.logAndNotify("Cannot delete remote item: ", e.msg);
|
||||
}
|
||||
|
|
24
src/sync.d
24
src/sync.d
|
@ -933,7 +933,17 @@ final class SyncEngine
|
|||
}
|
||||
|
||||
Item item;
|
||||
if (!itemdb.selectByPath(path, defaultDriveId, item)) {
|
||||
// Need to check all driveid's we know about, not just the defaultDriveId
|
||||
bool itemInDB = false;
|
||||
foreach (searchDriveId; driveIDsArray) {
|
||||
if (itemdb.selectByPath(path, searchDriveId, item)) {
|
||||
// item was found in the DB
|
||||
itemInDB = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Was the item found in the DB
|
||||
if (!itemInDB) {
|
||||
// this is odd .. this directory is not in the local database - just go delete it
|
||||
log.vlog("The requested directory to delete was not found in the local database - pushing delete request direct to OneDrive");
|
||||
uploadDeleteItem(item, path);
|
||||
|
@ -5331,9 +5341,19 @@ final class SyncEngine
|
|||
void deleteByPath(const(string) path)
|
||||
{
|
||||
Item item;
|
||||
if (!itemdb.selectByPath(path, defaultDriveId, item)) {
|
||||
// Need to check all driveid's we know about, not just the defaultDriveId
|
||||
bool itemInDB = false;
|
||||
foreach (searchDriveId; driveIDsArray) {
|
||||
if (itemdb.selectByPath(path, searchDriveId, item)) {
|
||||
// item was found in the DB
|
||||
itemInDB = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!itemInDB) {
|
||||
throw new SyncException("The item to delete is not in the local database");
|
||||
}
|
||||
|
||||
if (item.parentId == null) {
|
||||
// the item is a remote folder, need to do the operation on the parent
|
||||
enforce(itemdb.selectByPathWithoutRemote(path, defaultDriveId, item));
|
||||
|
|
Loading…
Reference in a new issue