mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 17:24:45 +00:00
refactor: centralize whitelist path checking with a new is_path_whitelisted helper function
This commit is contained in:
13
bin/clean.sh
13
bin/clean.sh
@@ -222,16 +222,9 @@ safe_clean() {
|
||||
[[ "$skip" == "true" ]] && continue
|
||||
|
||||
# Check user-defined whitelist
|
||||
if [[ ${#WHITELIST_PATTERNS[@]} -gt 0 ]]; then
|
||||
for w in "${WHITELIST_PATTERNS[@]}"; do
|
||||
# Match both exact path and glob pattern
|
||||
# shellcheck disable=SC2053
|
||||
if [[ "$path" == "$w" ]] || [[ $path == $w ]]; then
|
||||
skip=true
|
||||
((skipped_count++))
|
||||
break
|
||||
fi
|
||||
done
|
||||
if is_path_whitelisted "$path"; then
|
||||
skip=true
|
||||
((skipped_count++))
|
||||
fi
|
||||
[[ "$skip" == "true" ]] && continue
|
||||
[[ -e "$path" ]] && existing_paths+=("$path")
|
||||
|
||||
Reference in New Issue
Block a user