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 /server/controllers | |
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 'server/controllers')
-rw-r--r-- | server/controllers/services.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/server/controllers/services.ts b/server/controllers/services.ts index d0217c30a..189e1651b 100644 --- a/server/controllers/services.ts +++ b/server/controllers/services.ts | |||
@@ -3,6 +3,7 @@ import { EMBED_SIZE, PREVIEWS_SIZE, WEBSERVER, THUMBNAILS_SIZE } from '../initia | |||
3 | import { asyncMiddleware, oembedValidator } from '../middlewares' | 3 | import { asyncMiddleware, oembedValidator } from '../middlewares' |
4 | import { accountNameWithHostGetValidator } from '../middlewares/validators' | 4 | import { accountNameWithHostGetValidator } from '../middlewares/validators' |
5 | import { MChannelSummary } from '@server/types/models' | 5 | import { MChannelSummary } from '@server/types/models' |
6 | import { escapeHTML } from '@shared/core-utils/renderer' | ||
6 | 7 | ||
7 | const servicesRouter = express.Router() | 8 | const servicesRouter = express.Router() |
8 | 9 | ||
@@ -79,6 +80,7 @@ function buildOEmbed (options: { | |||
79 | const embedUrl = webserverUrl + embedPath | 80 | const embedUrl = webserverUrl + embedPath |
80 | let embedWidth = EMBED_SIZE.width | 81 | let embedWidth = EMBED_SIZE.width |
81 | let embedHeight = EMBED_SIZE.height | 82 | let embedHeight = EMBED_SIZE.height |
83 | const embedTitle = escapeHTML(title) | ||
82 | 84 | ||
83 | let thumbnailUrl = previewPath | 85 | let thumbnailUrl = previewPath |
84 | ? webserverUrl + previewPath | 86 | ? webserverUrl + previewPath |
@@ -96,7 +98,7 @@ function buildOEmbed (options: { | |||
96 | } | 98 | } |
97 | 99 | ||
98 | const html = `<iframe width="${embedWidth}" height="${embedHeight}" sandbox="allow-same-origin allow-scripts" ` + | 100 | const html = `<iframe width="${embedWidth}" height="${embedHeight}" sandbox="allow-same-origin allow-scripts" ` + |
99 | `src="${embedUrl}" frameborder="0" allowfullscreen></iframe>` | 101 | `title="${embedTitle}" src="${embedUrl}" frameborder="0" allowfullscreen></iframe>` |
100 | 102 | ||
101 | const json: any = { | 103 | const json: any = { |
102 | type: 'video', | 104 | type: 'video', |