Merge pull request #1716 from Salamandar/ynh_secure_remove

Fix ynh_safe_rm: check if target is not a broken symlink before erorring out.
This commit is contained in:
Alexandre Aubin 2024-06-29 17:23:50 +02:00 committed by GitHub
commit 44bbc34967
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -168,7 +168,7 @@ ynh_safe_rm() {
if [[ -z "$target" ]]; then
ynh_print_warn "ynh_safe_rm called with empty argument, ignoring."
elif [[ ! -e $target ]]; then
elif [[ ! -e "$target" ]] && [[ ! -L "$target" ]]; then
ynh_print_info "'$target' wasn't deleted because it doesn't exist."
elif ! _acceptable_path_to_delete "$target"; then
ynh_print_warn "Not deleting '$target' because it is not an acceptable path to delete."