Skip to content

Commit

Permalink
Multibyte product fix from Shopify/hydrogen#1209
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu-shopify committed Aug 14, 2023
1 parent f6fb7f1 commit 95a59f9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/routes/($locale).products.$productHandle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ function redirectToFirstVariant({product, request}) {
searchParams.set(option.name, option.value);
}

throw redirect(`/products/${product.handle}?${searchParams.toString()}`, 302);
// throw redirect(`/products/${product.handle}?${searchParams.toString()}`, 302);
// Fix from https://github.com/Shopify/hydrogen/issues/1209
// Use URL to avoid accidental double encoding
const newUrl = new URL(`/products/${product.handle}?${searchParams.toString()}`, 'http://example.com');
throw redirect(newUrl.pathname + newUrl.search, 302);
}

export default function Product() {
Expand Down

0 comments on commit 95a59f9

Please sign in to comment.