Skip to content

Commit

Permalink
fix: decode Webpage id to fix 404 on Webpages with nonsafe ids (#1301) (
Browse files Browse the repository at this point in the history
#1302)

* Fix: Decode Webpage Id to fix 404 on Webpages with nonsafe ids

* chore: add changeset

---------

Co-authored-by: Onur Yanar <onur4185@gmail.com>
Co-authored-by: Onur Yanar <onur4185@google.com>
  • Loading branch information
3 people committed Aug 22, 2024
1 parent 9f3c949 commit a620a19
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-panthers-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bigcommerce/catalyst-core": patch
---

fix: decode webpage id to fix 404 on some Webpages
4 changes: 2 additions & 2 deletions core/app/[locale]/(default)/webpages/normal/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const getWebpageData = cache(async (variables: { id: string }) => {
});

export async function generateMetadata({ params: { id } }: Props): Promise<Metadata> {
const webpage = await getWebpageData({ id });
const webpage = await getWebpageData({ id: decodeURIComponent(id) });

if (!webpage) {
return {};
Expand All @@ -59,7 +59,7 @@ export async function generateMetadata({ params: { id } }: Props): Promise<Metad
}

export default async function WebPage({ params: { id } }: Props) {
const webpage = await getWebpageData({ id });
const webpage = await getWebpageData({ id: decodeURIComponent(id) });

if (!webpage) {
notFound();
Expand Down

0 comments on commit a620a19

Please sign in to comment.