Skip to content
Snippets Groups Projects
Commit 33469c8c authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

fix: envsubst when variable contains a '&'

parent b4242a37
No related branches found
No related tags found
No related merge requests found
......@@ -295,7 +295,8 @@ stages:
}
function awkenvsubst() {
awk '!/# *nosubst/{while(match($0,"[$%]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH-3);val=ENVIRON[var]; gsub(/["\\]/,"\\\\&",val); gsub("\n","\\n",val);gsub("\r","\\r",val); gsub("[$%]{"var"}",val)}}1'
# performs variables escaping: '&' for gsub + JSON chars ('\' and '"')
awk '!/# *nosubst/{while(match($0,"[$%]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH-3);val=ENVIRON[var];gsub(/["\\&]/,"\\\\&",val);gsub("[$%]{"var"}",val)}}1'
}
function exec_hook() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment