1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 16:14:44 +00:00

Merge pull request #248 from JackPhallen/fix/protect-whitelisted-subdirectories

fix: Respect whitelisted subdirectories
This commit is contained in:
Tw93
2026-01-04 16:12:39 +08:00
committed by GitHub
3 changed files with 23 additions and 1 deletions

View File

@@ -605,6 +605,13 @@ is_path_whitelisted() {
[[ "$normalized_target" == $check_pattern ]]; then
return 0
fi
# Check if target is a parent directory of a whitelisted path
# e.g., if pattern is /path/to/dir/subdir and target is /path/to/dir,
# the target should be protected to preserve its whitelisted children
if [[ "$check_pattern" == "$normalized_target"/* ]]; then
return 0
fi
done
return 1

View File

@@ -66,7 +66,7 @@ declare -a DEFAULT_WHITELIST_PATTERNS=(
"$HOME/.ollama/models/*"
"$HOME/Library/Caches/com.nssurge.surge-mac/*"
"$HOME/Library/Application Support/com.nssurge.surge-mac/*"
"$HOME/Library/Caches/org.R-project.R/R/renv/*"
"$HOME/Library/Caches/org.R-project.R/R/renv"
"$HOME/Library/Caches/pypoetry/virtualenvs*"
"$HOME/Library/Caches/JetBrains*"
"$HOME/Library/Caches/com.jetbrains.toolbox*"