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

fix: improve cleanup by exiting alt screen and refine whitelisting for directory paths and R renv cache.

This commit is contained in:
Tw93
2026-01-04 17:41:14 +08:00
parent aedeed1817
commit 3906c020fe
3 changed files with 16 additions and 1 deletions

View File

@@ -598,6 +598,12 @@ is_path_whitelisted() {
for pattern in "${WHITELIST_PATTERNS[@]}"; do
# Pattern is already expanded/normalized in bin/clean.sh
local check_pattern="${pattern%/}"
local has_glob="false"
case "$check_pattern" in
*\**|*\?*|*\[*)
has_glob="true"
;;
esac
# Check for exact match or glob pattern match
# shellcheck disable=SC2053
@@ -612,6 +618,11 @@ is_path_whitelisted() {
if [[ "$check_pattern" == "$normalized_target"/* ]]; then
return 0
fi
# Check if target is a child of a whitelisted directory path
if [[ "$has_glob" == "false" && "$normalized_target" == "$check_pattern"/* ]]; then
return 0
fi
done
return 1