mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-17 21:26:41 +02:00
Fix that Business Shared Folders with parentheses are ignored (#1560)
* Fix issue where matching a OneDrive Business Shared Folder that contains '()' is not matched correctly
This commit is contained in:
parent
4b56a6103e
commit
6d92bc8210
|
@ -179,6 +179,14 @@ final class SelectiveSync
|
||||||
if (!name.matchFirst(businessSharedFoldersList).empty) {
|
if (!name.matchFirst(businessSharedFoldersList).empty) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
// try a direct comparison just in case
|
||||||
|
foreach (userFolder; businessSharedFoldersList) {
|
||||||
|
if (userFolder == name) {
|
||||||
|
// direct match
|
||||||
|
log.vdebug("'matchFirst' failed to match, however direct comparison was matched: ", name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
33
src/sync.d
33
src/sync.d
|
@ -660,6 +660,8 @@ final class SyncEngine
|
||||||
if (isItemFolder(searchResult)) {
|
if (isItemFolder(searchResult)) {
|
||||||
// item returned is a shared folder, not a shared file
|
// item returned is a shared folder, not a shared file
|
||||||
sharedFolderName = searchResult["name"].str;
|
sharedFolderName = searchResult["name"].str;
|
||||||
|
// Output Shared Folder Name early
|
||||||
|
log.vdebug("Shared Folder Name: ", sharedFolderName);
|
||||||
// Compare this to values in business_shared_folders
|
// Compare this to values in business_shared_folders
|
||||||
if(selectiveSync.isSharedFolderMatched(sharedFolderName)){
|
if(selectiveSync.isSharedFolderMatched(sharedFolderName)){
|
||||||
// Folder name matches what we are looking for
|
// Folder name matches what we are looking for
|
||||||
|
@ -671,7 +673,7 @@ final class SyncEngine
|
||||||
// "what if" there are 2 or more folders shared with me have the "same" name?
|
// "what if" there are 2 or more folders shared with me have the "same" name?
|
||||||
// The folder name will be the same, but driveId will be different
|
// The folder name will be the same, but driveId will be different
|
||||||
// This will then cause these 'shared folders' to cross populate data, which may not be desirable
|
// This will then cause these 'shared folders' to cross populate data, which may not be desirable
|
||||||
log.vdebug("Shared Folder Name: ", sharedFolderName);
|
log.vdebug("Shared Folder Name: MATCHED to any entry in 'business_shared_folders'");
|
||||||
log.vdebug("Parent Drive Id: ", searchResult["remoteItem"]["parentReference"]["driveId"].str);
|
log.vdebug("Parent Drive Id: ", searchResult["remoteItem"]["parentReference"]["driveId"].str);
|
||||||
log.vdebug("Shared Item Id: ", searchResult["remoteItem"]["id"].str);
|
log.vdebug("Shared Item Id: ", searchResult["remoteItem"]["id"].str);
|
||||||
Item databaseItem;
|
Item databaseItem;
|
||||||
|
@ -753,6 +755,8 @@ final class SyncEngine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.vdebug("Shared Folder Name: NO MATCH to any entry in 'business_shared_folders'");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// not a folder, is this a file?
|
// not a folder, is this a file?
|
||||||
|
@ -807,8 +811,24 @@ final class SyncEngine
|
||||||
JSONValue graphQuery = onedrive.getSharedWithMe();
|
JSONValue graphQuery = onedrive.getSharedWithMe();
|
||||||
if (graphQuery.type() == JSONType.object) {
|
if (graphQuery.type() == JSONType.object) {
|
||||||
// valid response from OneDrive
|
// valid response from OneDrive
|
||||||
|
string sharedFolderName;
|
||||||
foreach (searchResult; graphQuery["value"].array) {
|
foreach (searchResult; graphQuery["value"].array) {
|
||||||
string sharedFolderName = searchResult["name"].str;
|
// set sharedFolderName
|
||||||
|
sharedFolderName = searchResult["name"].str;
|
||||||
|
// Configure additional logging items for this array element
|
||||||
|
string sharedByName;
|
||||||
|
string sharedByEmail;
|
||||||
|
|
||||||
|
// Extra details for verbose logging
|
||||||
|
if ("sharedBy" in searchResult["remoteItem"]["shared"]) {
|
||||||
|
if ("displayName" in searchResult["remoteItem"]["shared"]["sharedBy"]["user"]) {
|
||||||
|
sharedByName = searchResult["remoteItem"]["shared"]["sharedBy"]["user"]["displayName"].str;
|
||||||
|
}
|
||||||
|
if ("email" in searchResult["remoteItem"]["shared"]["sharedBy"]["user"]) {
|
||||||
|
sharedByEmail = searchResult["remoteItem"]["shared"]["sharedBy"]["user"]["email"].str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Compare this to values in business_shared_folders
|
// Compare this to values in business_shared_folders
|
||||||
if(selectiveSync.isSharedFolderMatched(sharedFolderName)){
|
if(selectiveSync.isSharedFolderMatched(sharedFolderName)){
|
||||||
// Matched sharedFolderName to item in business_shared_folders
|
// Matched sharedFolderName to item in business_shared_folders
|
||||||
|
@ -833,6 +853,15 @@ final class SyncEngine
|
||||||
// Add this drive id to the array to search with
|
// Add this drive id to the array to search with
|
||||||
driveIDsArray ~= driveId;
|
driveIDsArray ~= driveId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Log who shared this to assist with sync data correlation
|
||||||
|
if ((sharedByName != "") && (sharedByEmail != "")) {
|
||||||
|
log.vlog("OneDrive Business Shared Folder - Shared By: ", sharedByName, " (", sharedByEmail, ")");
|
||||||
|
} else {
|
||||||
|
if (sharedByName != "") {
|
||||||
|
log.vlog("OneDrive Business Shared Folder - Shared By: ", sharedByName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue