From c0a4982ebe27c89f296a0bbd518e938f09d1f054 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 2 Mar 2023 10:35:59 +0100 Subject: Fix 404 when having ;threadId param --- server/controllers/client.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'server/controllers') 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 } async function generateWatchHtmlPage (req: express.Request, res: express.Response) { - const html = await ClientHtml.getWatchHTMLPage(req.params.id + '', req, res) + // Thread link is '/w/:videoId;threadId=:threadId' + // So to get the videoId we need to remove the last part + let videoId = req.params.id + '' + + const threadIdIndex = videoId.indexOf(';threadId') + if (threadIdIndex !== -1) videoId = videoId.substring(0, threadIdIndex) + + const html = await ClientHtml.getWatchHTMLPage(videoId, req, res) return sendHTML(html, res, true) } -- cgit v1.2.3