prom.awk: Correct regex escape
I'm not confident this ever worked as intended. Unless behavior in newer Gawks changed (since now it is issuing a warning where it wasn't previously). This replaced double quotes with '0'..which certainly solves the security problem of double quotes, but not in the intended way. I have no labels with double quotes and so never noticed. I suspect that I tried using // delimiters to avoid having to go through this escape mess ("\\\\" to produce "\\" which is recogniezd as a single "\" in the replacement, and then a fifth to escape the double quote. What a mess.master
parent
16108f0c2e
commit
d511fa8d17
2
prom.awk
2
prom.awk
|
@ -109,7 +109,7 @@ function _prom_assert_valid_label(name) {
|
||||||
|
|
||||||
# Escape double quotes in label value VALUE and return the result.
|
# Escape double quotes in label value VALUE and return the result.
|
||||||
function _prom_label_escape(value) {
|
function _prom_label_escape(value) {
|
||||||
return gensub(/"/, /\"/, "g", value)
|
return gensub(/"/, "\\\\\"", "g", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue