Skip to content

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

Escape IDs in staff section

dominik-zeglen012ec6dd5ce7
diff --git a/saleor/static/dashboard-next/staff/index.tsx b/saleor/static/dashboard-next/staff/index.tsx
index bfd7e004b1..e812c8e223 100644
--- a/saleor/static/dashboard-next/staff/index.tsx
+++ b/saleor/static/dashboard-next/staff/index.tsx
@@ -10,8 +10,8 @@ const StaffList: React.StatelessComponent<RouteComponentProps<{}>> = ({
}) => {
const qs = parseQs(location.search.substr(1));
const params = {
- after: qs.after,
- before: qs.before
+ after: decodeURIComponent(qs.after),
+ before: decodeURIComponent(qs.before)
};
return <StaffListComponent params={params} />;
};
@@ -21,7 +21,9 @@ interface StaffDetailsRouteProps {
}
const StaffDetails: React.StatelessComponent<
RouteComponentProps<StaffDetailsRouteProps>
-> = ({ match }) => <StaffDetailsComponent id={match.params.id} />;
+> = ({ match }) => (
+ <StaffDetailsComponent id={decodeURIComponent(match.params.id)} />
+);
const Component = ({ match }) => (
<Switch>
diff --git a/saleor/static/dashboard-next/staff/views/StaffList.tsx b/saleor/static/dashboard-next/staff/views/StaffList.tsx
index aa156f377b..acf3085ff0 100644
--- a/saleor/static/dashboard-next/staff/views/StaffList.tsx
+++ b/saleor/static/dashboard-next/staff/views/StaffList.tsx
@@ -47,7 +47,11 @@ export const StaffList: React.StatelessComponent<OrderListProps> = ({
pushMessage({
text: i18n.t("Succesfully added staff member")
});
- navigate(staffMemberDetailsUrl(data.staffCreate.user.id));
+ navigate(
+ staffMemberDetailsUrl(
+ encodeURIComponent(data.staffCreate.user.id)
+ )
+ );
}
};
return (
@@ -84,7 +88,9 @@ export const StaffList: React.StatelessComponent<OrderListProps> = ({
onNextPage={loadNextPage}
onPreviousPage={loadPreviousPage}
onRowClick={id => () =>
- navigate(staffMemberDetailsUrl(id))}
+ navigate(
+ staffMemberDetailsUrl(encodeURIComponent(id))
+ )}
/>
);
}}