Fix the escapeAttribute function using HTML entities instead of backslash escapes (#6206)
* Fix the escapeAttribute function using HTML entities instead of backslash escapes * Fix tests --------- Co-authored-by: Chocobozzz <me@florianbigard.com>
This commit is contained in:
parent
ba3820965f
commit
c4b039886e
|
@ -73,5 +73,5 @@ export function escapeHTML (stringParam: string) {
|
|||
export function escapeAttribute (value: string) {
|
||||
if (!value) return ''
|
||||
|
||||
return String(value).replace(/"/g, '\\"')
|
||||
return String(value).replace(/"/g, '"')
|
||||
}
|
||||
|
|
|
@ -273,8 +273,8 @@ describe('Test Open Graph and Twitter cards HTML tags', function () {
|
|||
const res = await makeGetRequest({ url: servers[0].url, path: '/a/root', accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
|
||||
const text = res.text
|
||||
|
||||
expect(text).to.contain(`<meta property="twitter:description" content="\\"super description\\"" />`)
|
||||
expect(text).to.contain(`<meta property="og:description" content="\\"super description\\"" />`)
|
||||
expect(text).to.contain(`<meta property="twitter:description" content=""super description"" />`)
|
||||
expect(text).to.contain(`<meta property="og:description" content=""super description"" />`)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue