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:
infinite-persistence 2022-06-13 20:35:24 +08:00 committed by GitHub
parent f755423361
commit 075b8bcf62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) => {