Update helpers/helpers.v2.1.d/utils: use regex matching to check if path is child from a parent path

This commit is contained in:
Alexandre Aubin 2024-06-28 16:56:28 +02:00 committed by GitHub
parent 3b26ccc2a5
commit 75d7042974
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -241,7 +241,7 @@ _ynh_apply_default_permissions() {
[ -n "$2" ] || return 1
local child=$(realpath "$1" 2>/dev/null)
local parent=$(realpath "$2" 2>/dev/null)
[[ "${child/$parent/}" != "$child" ]]
[[ "${child}" =~ ^$parent ]]
}
# App files can have files of their own