forked from hummypkg/webif
Fix escaping on Jim critical characters - {}[];
This commit is contained in:
parent
f85e83f1df
commit
230491ca76
@ -101,9 +101,13 @@ proc ::js::_unescape {str} {
|
||||
}
|
||||
|
||||
proc ::js::escape {str} {
|
||||
return [subst -nobackslashes -novariables \
|
||||
[regsub -all -- {[^A-Za-z0-9@*_+./-]+} $str \
|
||||
{[::js::_escape {&}]}]]
|
||||
set re1 {[\;\[\]\{\}]}
|
||||
set re2 {[^A-Za-z0-9@*_+./-]+}
|
||||
regsub -all -- $re1 $str {\\&} str1
|
||||
regsub -all -- $re2 $str1 \
|
||||
{[subst -nobackslashes -novariables \
|
||||
[::js::_escape [subst {&}]]]} str2
|
||||
return [subst -nobackslashes -novariables $str2]
|
||||
}
|
||||
|
||||
proc ::js::unescape {str} {
|
||||
|
Loading…
Reference in New Issue
Block a user