Skip to content

Commit

Permalink
encode string when checking for existance
Browse files Browse the repository at this point in the history
  • Loading branch information
tom0827 committed Jul 10, 2024
1 parent 56f9c37 commit eb7737f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ class IndigenousNationService implements ServiceBase {
);
}
async checkIndigenousNationExists(name: string, id: number) {
const encodedName = encodeURIComponent(name);
return await http.GetRequest(
Endpoints.IndigenousNations.INDIGENOUS_NATIONS +
`/exists?name=${name}${id ? "&indigenous_nation_id=" + id : ""}`
`/exists?name=${encodedName}${id ? "&indigenous_nation_id=" + id : ""}`
);
}
}
Expand Down
3 changes: 2 additions & 1 deletion epictrack-web/src/services/projectService/projectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ class ProjectService implements ServiceBase {
}

async checkProjectExists(name: string, id: number) {
const encodedName = encodeURIComponent(name);
return await http.GetRequest(
Endpoints.Projects.PROJECTS +
`/exists?name=${name}${id ? "&project_id=" + id : ""}`
`/exists?name=${encodedName}${id ? "&project_id=" + id : ""}`
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ class ProponentService implements ServiceBase {
}

async checkProponentExists(name: string, id: number) {
const encodedName = encodeURIComponent(name);
return await http.GetRequest(
Endpoints.Proponents.PROPONENTS +
`/exists?name=${name}${id ? "&proponent_id=" + id : ""}`
`/exists?name=${encodedName}${id ? "&proponent_id=" + id : ""}`
);
}
}
Expand Down
3 changes: 2 additions & 1 deletion epictrack-web/src/services/workService/workService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ class WorkService implements ServiceBase {
}

async checkWorkExists(title: string, id?: string) {
const encodedTitle = encodeURIComponent(title);
return await http.GetRequest(
Endpoints.Works.WORKS +
`/exists?title=${title}${id ? "&work_id=" + id : ""}`
`/exists?title=${encodedTitle}${id ? "&work_id=" + id : ""}`
);
}

Expand Down

0 comments on commit eb7737f

Please sign in to comment.