diff options
author | Thavarasa Prasanth <45243326+pthavarasa@users.noreply.github.com> | 2021-03-31 08:32:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-31 08:32:05 +0200 |
commit | 4097c6d66cb2919c28b5bce44b259e630923fbe0 (patch) | |
tree | d57897b0b8762202a0be90388e9a79153690b9d9 /shared/core-utils/renderer | |
parent | 47099aba46be7757d833422f1706b99a3c0e28ea (diff) | |
download | PeerTube-4097c6d66cb2919c28b5bce44b259e630923fbe0.tar.gz PeerTube-4097c6d66cb2919c28b5bce44b259e630923fbe0.tar.zst PeerTube-4097c6d66cb2919c28b5bce44b259e630923fbe0.zip |
fix missing title attribute on <iframe> tag suggested for embedding (#3901)
* title attribute is missing on <iframe> tag suggested for embedding #3861
* fix #3901
* fix: escapeHTML #3901
* fix: playlist title instead of video title #3901
* fix #3901
* assign title directly #3901
Diffstat (limited to 'shared/core-utils/renderer')
-rw-r--r-- | shared/core-utils/renderer/html.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/shared/core-utils/renderer/html.ts b/shared/core-utils/renderer/html.ts index 1220848a0..de4ad47ac 100644 --- a/shared/core-utils/renderer/html.ts +++ b/shared/core-utils/renderer/html.ts | |||
@@ -19,3 +19,21 @@ export const SANITIZE_OPTIONS = { | |||
19 | } | 19 | } |
20 | } | 20 | } |
21 | } | 21 | } |
22 | |||
23 | // Thanks: https://stackoverflow.com/a/12034334 | ||
24 | export function escapeHTML (stringParam: string) { | ||
25 | if (!stringParam) return '' | ||
26 | |||
27 | const entityMap = { | ||
28 | '&': '&', | ||
29 | '<': '<', | ||
30 | '>': '>', | ||
31 | '"': '"', | ||
32 | '\'': ''', | ||
33 | '/': '/', | ||
34 | '`': '`', | ||
35 | '=': '=' | ||
36 | } | ||
37 | |||
38 | return String(stringParam).replace(/[&<>"'`=/]/g, s => entityMap[s]) | ||
39 | } | ||