mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-01 13:32:16 +02:00
Check the given local path in reverse order for a skip_dir match on --resync (#1125)
* When matching skip_dir entries, if there is no direct first match, perform a reverse directory walk to test each path block for a match
This commit is contained in:
parent
363f64df36
commit
b4c3da6e10
|
@ -89,15 +89,30 @@ final class SelectiveSync
|
||||||
|
|
||||||
// Try full path match first
|
// Try full path match first
|
||||||
if (!name.matchFirst(dirmask).empty) {
|
if (!name.matchFirst(dirmask).empty) {
|
||||||
|
log.vdebug("'!name.matchFirst(dirmask).empty' returned true = matched");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// Do we check the base name as well?
|
// Do we check the base name as well?
|
||||||
if (!skipDirStrictMatch) {
|
if (!skipDirStrictMatch) {
|
||||||
// check just the basename in the path
|
log.vdebug("No Strict Matching Enforced");
|
||||||
string parent = baseName(name);
|
|
||||||
if(!parent.matchFirst(dirmask).empty) {
|
// Test the entire path working backwards from child
|
||||||
return true;
|
string path = buildNormalizedPath(name);
|
||||||
|
string checkPath;
|
||||||
|
auto paths = pathSplitter(path);
|
||||||
|
|
||||||
|
foreach_reverse(directory; paths) {
|
||||||
|
if (directory != "/") {
|
||||||
|
// This will add a leading '/' but that needs to be stripped to check
|
||||||
|
checkPath = "/" ~ directory ~ checkPath;
|
||||||
|
if(!checkPath.strip('/').matchFirst(dirmask).empty) {
|
||||||
|
log.vdebug("'!checkPath.matchFirst(dirmask).empty' returned true = matched");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.vdebug("Strict Matching Enforced - No Match");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// no match
|
// no match
|
||||||
|
|
Loading…
Reference in a new issue