Fix 'Skipping uploading this new file as parent path is not in the database' when uploading to a Personal Shared Folder (#1009)

* Fix 'Skipping uploading this new file as parent path is not in the database' when uploading to a Personal Shared Folder
* When syncing OneDrive Personal Shared Folders, add the driveId to the driveIdArray
* Rename function to be more representative of what function does
This commit is contained in:
abraunegg 2020-08-06 17:45:10 +10:00 committed by GitHub
parent 2fe0574bcf
commit 786446f79b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View file

@ -248,7 +248,7 @@ final class ItemDatabase
}
// same as selectByPath() but it does not traverse remote folders
bool selectByPathWithRemote(const(char)[] path, string rootDriveId, out Item item)
bool selectByPathWithoutRemote(const(char)[] path, string rootDriveId, out Item item)
{
Item currItem = { driveId: rootDriveId };

View file

@ -560,8 +560,13 @@ final class SyncEngine
} else {
log.vlog("Syncing this OneDrive Personal Shared Folder: ", item.name);
}
// Check OneDrive Personal Folders
// Check this OneDrive Personal Shared Folders
applyDifferences(item.remoteDriveId, item.remoteId, performFullItemScan);
// Keep the driveIDsArray with unique entries only
if (!canFind(driveIDsArray, item.remoteDriveId)) {
// Add this OneDrive Personal Shared Folder driveId array
driveIDsArray ~= item.remoteDriveId;
}
}
}
@ -2942,7 +2947,7 @@ final class SyncEngine
// we are in a --dry-run situation, directory appears to have deleted locally - this directory may never have existed as we never downloaded it ..
// Check if path does not exist in database
Item databaseItem;
if (!itemdb.selectByPathWithRemote(path, defaultDriveId, databaseItem)) {
if (!itemdb.selectByPathWithoutRemote(path, defaultDriveId, databaseItem)) {
// Path not found in database
log.vlog("The directory has been deleted locally");
if (noRemoteDelete) {
@ -3617,7 +3622,7 @@ final class SyncEngine
foreach (driveId; driveIDsArray) {
// Query the database for this parent path using each driveId
Item dbResponse;
if(itemdb.selectByPathWithRemote(parentPath, driveId, dbResponse)){
if(itemdb.selectByPathWithoutRemote(parentPath, driveId, dbResponse)){
// parent path was found in the database
parent = dbResponse;
}
@ -3821,7 +3826,7 @@ final class SyncEngine
foreach (driveId; driveIDsArray) {
// Query the database for this parent path using each driveId
Item dbResponse;
if(itemdb.selectByPathWithRemote(parentPath, driveId, dbResponse)){
if(itemdb.selectByPath(parentPath, driveId, dbResponse)){
// parent path was found in the database
parent = dbResponse;
parentPathFoundInDB = true;
@ -4753,7 +4758,7 @@ final class SyncEngine
}
if (fromItem.parentId == null) {
// the item is a remote folder, need to do the operation on the parent
enforce(itemdb.selectByPathWithRemote(from, defaultDriveId, fromItem));
enforce(itemdb.selectByPathWithoutRemote(from, defaultDriveId, fromItem));
}
if (itemdb.selectByPath(to, defaultDriveId, toItem)) {
// the destination has been overwritten
@ -4832,7 +4837,7 @@ final class SyncEngine
}
if (item.parentId == null) {
// the item is a remote folder, need to do the operation on the parent
enforce(itemdb.selectByPathWithRemote(path, defaultDriveId, item));
enforce(itemdb.selectByPathWithoutRemote(path, defaultDriveId, item));
}
try {
if (noRemoteDelete) {