diff options
author | Chocobozzz <me@florianbigard.com> | 2023-03-02 10:35:59 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-03-02 10:35:59 +0100 |
commit | c0a4982ebe27c89f296a0bbd518e938f09d1f054 (patch) | |
tree | 6b2f595c166490dd1e582d829db2aa507dd02531 /server | |
parent | e2d8587bd36239f0ba0be59a9185682072a392fc (diff) | |
download | PeerTube-c0a4982ebe27c89f296a0bbd518e938f09d1f054.tar.gz PeerTube-c0a4982ebe27c89f296a0bbd518e938f09d1f054.tar.zst PeerTube-c0a4982ebe27c89f296a0bbd518e938f09d1f054.zip |
Fix 404 when having ;threadId param
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/client.ts | 9 | ||||
-rw-r--r-- | server/tests/client.ts | 8 |
2 files changed, 16 insertions, 1 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts index f9514d988..a85c10720 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts | |||
@@ -138,7 +138,14 @@ async function generateEmbedHtmlPage (req: express.Request, res: express.Respons | |||
138 | } | 138 | } |
139 | 139 | ||
140 | async function generateWatchHtmlPage (req: express.Request, res: express.Response) { | 140 | async function generateWatchHtmlPage (req: express.Request, res: express.Response) { |
141 | const html = await ClientHtml.getWatchHTMLPage(req.params.id + '', req, res) | 141 | // Thread link is '/w/:videoId;threadId=:threadId' |
142 | // So to get the videoId we need to remove the last part | ||
143 | let videoId = req.params.id + '' | ||
144 | |||
145 | const threadIdIndex = videoId.indexOf(';threadId') | ||
146 | if (threadIdIndex !== -1) videoId = videoId.substring(0, threadIdIndex) | ||
147 | |||
148 | const html = await ClientHtml.getWatchHTMLPage(videoId, req, res) | ||
142 | 149 | ||
143 | return sendHTML(html, res, true) | 150 | return sendHTML(html, res, true) |
144 | } | 151 | } |
diff --git a/server/tests/client.ts b/server/tests/client.ts index e0dae2b5e..9a20c2a10 100644 --- a/server/tests/client.ts +++ b/server/tests/client.ts | |||
@@ -225,6 +225,14 @@ describe('Test a client controllers', function () { | |||
225 | } | 225 | } |
226 | }) | 226 | }) |
227 | 227 | ||
228 | it('Should have valid Open Graph tags on the watch page with thread id Angular param', async function () { | ||
229 | for (const path of watchVideoBasePaths) { | ||
230 | for (const id of videoIds) { | ||
231 | await watchVideoPageTest(path + id + ';threadId=1') | ||
232 | } | ||
233 | } | ||
234 | }) | ||
235 | |||
228 | it('Should have valid Open Graph tags on the watch playlist page', async function () { | 236 | it('Should have valid Open Graph tags on the watch playlist page', async function () { |
229 | for (const path of watchPlaylistBasePaths) { | 237 | for (const path of watchPlaylistBasePaths) { |
230 | for (const id of playlistIds) { | 238 | for (const id of playlistIds) { |