Fix legit variable getting caught as an info to be redacted by the core

This commit is contained in:
Alexandre Aubin 2019-07-18 18:16:46 +02:00
parent 46310dbb6c
commit 7e99541064

View file

@ -378,16 +378,18 @@ ynh_secure_remove () {
ynh_get_plain_key() {
local prefix="#"
local founded=0
local key=$1
# We call this key_ so that it's not caught as
# an info to be redacted by the core
local key_=$1
shift
while read line; do
if [[ "$founded" == "1" ]] ; then
[[ "$line" =~ ^${prefix}[^#] ]] && return
echo $line
elif [[ "$line" =~ ^${prefix}${key}$ ]]; then
elif [[ "$line" =~ ^${prefix}${key_}$ ]]; then
if [[ -n "${1:-}" ]]; then
prefix+="#"
key=$1
key_=$1
shift
else
founded=1