mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Escape quotes for html attributes
This commit is contained in:
parent
63c4a02ce0
commit
edc695263f
3 changed files with 26 additions and 6 deletions
|
@ -69,3 +69,9 @@ export function escapeHTML (stringParam: string) {
|
|||
|
||||
return String(stringParam).replace(/[&<>"'`=/]/g, s => entityMap[s])
|
||||
}
|
||||
|
||||
export function escapeAttribute (value: string) {
|
||||
if (!value) return ''
|
||||
|
||||
return String(value).replace(/"/g, '\\"')
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue