From ccd91e40de836e863e511ff57f3a89dd13bab294 Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Thu, 12 Sep 2024 11:33:41 -0400 Subject: [PATCH] Normalize ULID slugs to uppercase --- src/pages/[...slug].astro | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/[...slug].astro b/src/pages/[...slug].astro index e6e7ad2..ee61902 100644 --- a/src/pages/[...slug].astro +++ b/src/pages/[...slug].astro @@ -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) { @@ -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(); }