Skip to content

Commit

Permalink
Properly encode project names
Browse files Browse the repository at this point in the history
  • Loading branch information
shaun-leach authored and replaysMike committed Aug 5, 2024
1 parent 08a18ac commit 74375c5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Binner/Binner.Web/ClientApp/src/pages/Bom.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function Bom(props) {

const loadProject = async (projectName) => {
setLoading(true);
const response = await fetchApi(`api/bom?name=${projectName}`).catch((c) => {
const response = await fetchApi(`api/bom?name=${encodeURIComponent(projectName)}`).catch((c) => {
if (c.status === 404) {
toast.error(t("error.projectNotFound", "Could not find project named {{projectName}}"), { projectName });
setPageDisabled(true);
Expand Down
2 changes: 1 addition & 1 deletion Binner/Binner.Web/ClientApp/src/pages/Boms.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export function Boms (props) {
const handleLoadBom = (e, p) => {
e.preventDefault();
e.stopPropagation();
props.history(`/bom/${p.name}`);
props.history(`/bom/${encodeURIComponent(p.name)}`);
};

const onCreateProject = async () => {
Expand Down
2 changes: 1 addition & 1 deletion Binner/Binner.Web/ClientApp/src/pages/Project.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function Project(props) {

const loadProject = async (projectName) => {
setLoading(true);
const response = await fetchApi(`api/bom?name=${projectName}`)
const response = await fetchApi(`api/bom?name=${encodeURIComponent(projectName)}`)
.catch(c => {
if (c.status === 404){
toast.error(t('error.projectNotFound', "Could not find a project named {{projectName}}", { projectName }));
Expand Down

0 comments on commit 74375c5

Please sign in to comment.