Skip to content

Commit

Permalink
Normalize ULID slugs to uppercase
Browse files Browse the repository at this point in the history
  • Loading branch information
zephraph authored and gitbutler-client committed Sep 12, 2024
1 parent 3e153bb commit ccd91e4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/pages/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ if (!isULID(slug)) {
return Astro.rewrite("/404");
}
}
slug = slug.toUpperCase();
// We've already done redirection of the home slug, so skip if it matches that
if (slug !== HOME_SLUG) {
Expand All @@ -73,9 +74,7 @@ if (process.env.NODE_ENV === "development") {
// In prod pull from R2
} else {
const result = await Astro.locals.runtime.env.R2_BUCKET.get(
slug.toUpperCase()
);
const result = await Astro.locals.runtime.env.R2_BUCKET.get(slug);
if (!result) return Astro.rewrite("/404");
content = await result.text();
}
Expand Down

0 comments on commit ccd91e4

Please sign in to comment.