Skip to content

Commit

Permalink
Merge pull request #2067 from graphcommerce-org/fix/handle-redirect
Browse files Browse the repository at this point in the history
Implement URL validation to prevent empty values for the HandleRedirect query
  • Loading branch information
paales authored Oct 4, 2023
2 parents 76de862 + 7babf41 commit 1c0f665
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/rich-guests-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphcommerce/magento-store': patch
---

Prevent HandleRedirect errors by filtering out empty URL values from the candidates array.
2 changes: 1 addition & 1 deletion packages/magento-store/utils/redirectOrNotFound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export async function redirectOrNotFound(
candidates.add(from.endsWith(suffix) ? from.slice(0, -suffix.length) : `${from}${suffix}`)
})

const routePromises = [...candidates].map(
const routePromises = [...candidates].filter(Boolean).map(
async (url) =>
(
await client.query({
Expand Down

0 comments on commit 1c0f665

Please sign in to comment.