mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-23 08:02:16 +02:00
Update 'root:' removal for 'skip_dir' path checking
* Update 'root:' removal for 'skip_dir' path checking
This commit is contained in:
parent
d20b62da57
commit
0ce088f0e2
35
src/sync.d
35
src/sync.d
|
@ -1379,16 +1379,15 @@ class SyncEngine {
|
|||
simplePathToCheck = onedriveJSONItem["name"].str;
|
||||
}
|
||||
|
||||
// If 'simplePathToCheck' or 'complexPathToCheck' is of the following format: root:/folder
|
||||
// If 'simplePathToCheck' or 'complexPathToCheck' is of the following format: root:/folder
|
||||
// then isDirNameExcluded matching will not work
|
||||
// Clean up 'root:' if present
|
||||
if (startsWith(simplePathToCheck, "root:")){
|
||||
if (simplePathToCheck.canFind(":")) {
|
||||
addLogEntry("Updating simplePathToCheck to remove 'root:'", ["debug"]);
|
||||
simplePathToCheck = strip(simplePathToCheck, "root:");
|
||||
simplePathToCheck = processPathToRemoveRootReference(simplePathToCheck);
|
||||
}
|
||||
if (startsWith(complexPathToCheck, "root:")){
|
||||
if (complexPathToCheck.canFind(":")) {
|
||||
addLogEntry("Updating complexPathToCheck to remove 'root:'", ["debug"]);
|
||||
complexPathToCheck = strip(complexPathToCheck, "root:");
|
||||
complexPathToCheck = processPathToRemoveRootReference(complexPathToCheck);
|
||||
}
|
||||
|
||||
// OK .. what checks are we doing?
|
||||
|
@ -3233,16 +3232,15 @@ class SyncEngine {
|
|||
simplePathToCheck = onedriveJSONItem["name"].str;
|
||||
}
|
||||
|
||||
// If 'simplePathToCheck' or 'complexPathToCheck' is of the following format: root:/folder
|
||||
// If 'simplePathToCheck' or 'complexPathToCheck' is of the following format: root:/folder
|
||||
// then isDirNameExcluded matching will not work
|
||||
// Clean up 'root:' if present
|
||||
if (startsWith(simplePathToCheck, "root:")){
|
||||
if (simplePathToCheck.canFind(":")) {
|
||||
addLogEntry("Updating simplePathToCheck to remove 'root:'", ["debug"]);
|
||||
simplePathToCheck = strip(simplePathToCheck, "root:");
|
||||
simplePathToCheck = processPathToRemoveRootReference(simplePathToCheck);
|
||||
}
|
||||
if (startsWith(complexPathToCheck, "root:")){
|
||||
if (complexPathToCheck.canFind(":")) {
|
||||
addLogEntry("Updating complexPathToCheck to remove 'root:'", ["debug"]);
|
||||
complexPathToCheck = strip(complexPathToCheck, "root:");
|
||||
complexPathToCheck = processPathToRemoveRootReference(complexPathToCheck);
|
||||
}
|
||||
|
||||
// OK .. what checks are we doing?
|
||||
|
@ -3266,7 +3264,7 @@ class SyncEngine {
|
|||
}
|
||||
}
|
||||
// End Result
|
||||
addLogEntry("skip_dir exclude result (directory based): " ~ clientSideRuleExcludesPath, ["debug"]);
|
||||
addLogEntry("skip_dir exclude result (directory based): " ~ to!string(clientSideRuleExcludesPath), ["debug"]);
|
||||
if (clientSideRuleExcludesPath) {
|
||||
// This path should be skipped
|
||||
addLogEntry("Skipping item - excluded by skip_dir config: " ~ matchDisplay, ["verbose"]);
|
||||
|
@ -7541,4 +7539,15 @@ class SyncEngine {
|
|||
object.destroy(uploadFileOneDriveApiInstance);
|
||||
}
|
||||
}
|
||||
|
||||
// Function to process the path by removing prefix up to ':' - remove '/drive/root:' from a path string
|
||||
string processPathToRemoveRootReference(ref string pathToCheck) {
|
||||
long colonIndex = pathToCheck.indexOf(":");
|
||||
if (colonIndex != -1) {
|
||||
addLogEntry("Updating " ~ pathToCheck ~ " to remove prefix up to ':'", ["debug"]);
|
||||
pathToCheck = pathToCheck[colonIndex + 1 .. $];
|
||||
addLogEntry("Updated path for 'skip_dir' check: " ~ pathToCheck, ["debug"]);
|
||||
}
|
||||
return pathToCheck;
|
||||
}
|
||||
}
|
|
@ -167,7 +167,7 @@ Regex!char wild2regex(const(char)[] pattern) {
|
|||
str ~= "\\+";
|
||||
break;
|
||||
case ' ':
|
||||
str ~= "\\s"; // Changed to match exactly one whitespace. str ~= "\\s+";
|
||||
str ~= "\\s"; // Changed to match exactly one whitespace. Was: str ~= "\\s+";
|
||||
break;
|
||||
case '/':
|
||||
str ~= "\\/";
|
||||
|
|
Loading…
Reference in a new issue