Handle invalid /$/download
and /$/stream
with a 404 (#1676)
## Issue - When `/$/download/:claimname/:claimId` is invalid, it results in a bad redirect loop that keeps requesting the same thing. Eventually it stops, though. - When `/$/stream/:claimname/:claimId` is invalid, it results in a 302 page that simply says `Redirecting to .`, and is increasing in count in the search console. ## Fix Return a 404 not found for these.
This commit is contained in:
parent
f755423361
commit
075b8bcf62
1 changed files with 7 additions and 3 deletions
|
@ -42,13 +42,17 @@ router.get(`/$/api/content/v2/get`, async (ctx) => getHomepage(ctx, 2));
|
|||
|
||||
router.get(`/$/download/:claimName/:claimId`, async (ctx) => {
|
||||
const streamUrl = await getStreamUrl(ctx);
|
||||
if (streamUrl) {
|
||||
const downloadUrl = `${streamUrl}?download=1`;
|
||||
ctx.redirect(downloadUrl);
|
||||
}
|
||||
});
|
||||
|
||||
router.get(`/$/stream/:claimName/:claimId`, async (ctx) => {
|
||||
const streamUrl = await getStreamUrl(ctx);
|
||||
if (streamUrl) {
|
||||
ctx.redirect(streamUrl);
|
||||
}
|
||||
});
|
||||
|
||||
router.get(`/$/activate`, async (ctx) => {
|
||||
|
|
Loading…
Reference in a new issue