Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Escape IDs in orders section

dominik-zeglen1fa0dc464eb6
diff --git a/saleor/static/dashboard-next/orders/index.tsx b/saleor/static/dashboard-next/orders/index.tsx
index dbcf38adbf..9a74d25c47 100644
--- a/saleor/static/dashboard-next/orders/index.tsx
+++ b/saleor/static/dashboard-next/orders/index.tsx
@@ -13,8 +13,8 @@ const OrderList: React.StatelessComponent<RouteComponentProps<any>> = ({
}) => {
const qs = parseQs(location.search.substr(1));
const params = {
- after: qs.after,
- before: qs.before
+ after: decodeURIComponent(qs.after),
+ before: decodeURIComponent(qs.before)
};
return <OrderListComponent params={params} />;
};
@@ -22,7 +22,7 @@ const OrderList: React.StatelessComponent<RouteComponentProps<any>> = ({
const OrderDetails: React.StatelessComponent<RouteComponentProps<any>> = ({
match
}) => {
- return <OrderDetailsComponent id={match.params.id} />;
+ return <OrderDetailsComponent id={decodeURIComponent(match.params.id)} />;
};
const Component = ({ match }) => (
diff --git a/saleor/static/dashboard-next/orders/views/OrderDetails.tsx b/saleor/static/dashboard-next/orders/views/OrderDetails.tsx
index a268e8190d..69a6545253 100644
--- a/saleor/static/dashboard-next/orders/views/OrderDetails.tsx
+++ b/saleor/static/dashboard-next/orders/views/OrderDetails.tsx
@@ -466,7 +466,9 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({
})
}
onProductClick={id => () =>
- navigate(productUrl(id))}
+ navigate(
+ productUrl(encodeURIComponent(id))
+ )}
onBillingAddressEdit={variables =>
orderUpdate.mutate({
id,
@@ -558,7 +560,9 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({
label: country.country
}))}
onProductClick={id => () =>
- navigate(productUrl(id))}
+ navigate(
+ productUrl(encodeURIComponent(id))
+ )}
onBillingAddressEdit={variables =>
orderUpdate.mutate({
id,
diff --git a/saleor/static/dashboard-next/orders/views/OrderList.tsx b/saleor/static/dashboard-next/orders/views/OrderList.tsx
index 2f1e31acdf..712dc0ae12 100644
--- a/saleor/static/dashboard-next/orders/views/OrderList.tsx
+++ b/saleor/static/dashboard-next/orders/views/OrderList.tsx
@@ -30,7 +30,9 @@ export const OrderList: React.StatelessComponent<OrderListProps> = ({
pushMessage({
text: i18n.t("Order draft succesfully created")
});
- navigate(orderUrl(data.draftOrderCreate.order.id));
+ navigate(
+ orderUrl(encodeURIComponent(data.draftOrderCreate.order.id))
+ );
};
return (
<TypedOrderDraftCreateMutation
@@ -65,7 +67,8 @@ export const OrderList: React.StatelessComponent<OrderListProps> = ({
onAdd={createOrder}
onNextPage={loadNextPage}
onPreviousPage={loadPreviousPage}
- onRowClick={id => () => navigate(orderUrl(id))}
+ onRowClick={id => () =>
+ navigate(orderUrl(encodeURIComponent(id)))}
/>
);
}}