mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2026-11-11 00:40:07 +01:00
feat: Add escapeHTML function (#1303)
This commit is contained in:
1 parent
949c288565
commit
81536818df
2 files changed
+14
-1
No files matched your search
+2
-1
@@ -11,8 +11,9 @@ escape() {
|
||||
s=${s//</\<}
|
||||
s=${s//>/\>}
|
||||
s=${s//'"'/\"}
|
||||
s=${s//"'"/\'}
|
||||
|
||||
printf -- %s "$s"
|
||||
printf '%s' "$s"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -373,6 +373,18 @@ escape () {
|
||||
return 0
|
||||
}
|
||||
|
||||
escapeXML() {
|
||||
|
||||
printf '%s' "$1" | sed \
|
||||
-e 's/&/\&/g' \
|
||||
-e 's/</\</g' \
|
||||
-e 's/>/\>/g' \
|
||||
-e 's/"/\"/g' \
|
||||
-e "s/'/\'/g"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
html() {
|
||||
|
||||
local title
|
||||
|
||||
Reference in new issue
Block a user