Skip to content

Commit

Permalink
Merge pull request #888 from loculus-project/840-inconsistent-404-not…
Browse files Browse the repository at this point in the history
…-found-behavior

fix(website): send 404 instead of redirect
  • Loading branch information
bh-ethz authored Feb 5, 2024
2 parents d1db4d5 + 05fc64c commit 4366bcf
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions website/src/middleware/organismValidatorMiddleware.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { defineMiddleware } from 'astro/middleware';

import { cleanOrganism } from '../components/Navigation/cleanOrganism.ts';
import { routes } from '../routes.ts';

export const organismValidatorMiddleware = defineMiddleware(async (context, next) => {
const organism = context.params.organism;
Expand All @@ -11,7 +10,7 @@ export const organismValidatorMiddleware = defineMiddleware(async (context, next

const { organism: validatedOrganism } = cleanOrganism(organism);
if (validatedOrganism === undefined) {
return context.redirect(routes.notFoundPage());
return new Response(undefined, { status: 404 });
}

return next();
Expand Down

0 comments on commit 4366bcf

Please sign in to comment.