Browse Source

Fix 404 when having ;threadId param

tags/v5.1.0
Chocobozzz 1 month ago
parent
commit
c0a4982ebe
No known key found for this signature in database GPG Key ID: 583A612D890159BE
2 changed files with 16 additions and 1 deletions
  1. +8
    -1
      server/controllers/client.ts
  2. +8
    -0
      server/tests/client.ts

+ 8
- 1
server/controllers/client.ts View File

@@ -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)
}


+ 8
- 0
server/tests/client.ts View File

@@ -225,6 +225,14 @@ describe('Test a client controllers', function () {
}
})

it('Should have valid Open Graph tags on the watch page with thread id Angular param', async function () {
for (const path of watchVideoBasePaths) {
for (const id of videoIds) {
await watchVideoPageTest(path + id + ';threadId=1')
}
}
})

it('Should have valid Open Graph tags on the watch playlist page', async function () {
for (const path of watchPlaylistBasePaths) {
for (const id of playlistIds) {


Loading…
Cancel
Save