]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20532 Encode path parameters for mapping endpoints
authorViktor Vorona <viktor.vorona@sonarsource.com>
Thu, 28 Sep 2023 09:22:10 +0000 (11:22 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 28 Sep 2023 20:03:12 +0000 (20:03 +0000)
server/sonar-web/src/main/js/api/provisioning.ts

index b65ded5c9a27da5e4f1f91153605c2886ed03ab8..a3bef28efb1f288ff546b1f06dd1837ea1a5523e 100644 (file)
@@ -66,7 +66,10 @@ export function updateGithubRolesMapping(
   role: string,
   data: Partial<Pick<GitHubMapping, 'permissions'>>,
 ) {
-  return axios.patch<GitHubMapping>(`/api/v2/github-permission-mappings/${role}`, data);
+  return axios.patch<GitHubMapping>(
+    `/api/v2/github-permission-mappings/${encodeURIComponent(role)}`,
+    data,
+  );
 }
 
 export function addGithubRolesMapping(data: Omit<GitHubMapping, 'id'>) {
@@ -74,5 +77,5 @@ export function addGithubRolesMapping(data: Omit<GitHubMapping, 'id'>) {
 }
 
 export function deleteGithubRolesMapping(role: string) {
-  return axios.delete(`/api/v2/github-permission-mappings/${role}`);
+  return axios.delete(`/api/v2/github-permission-mappings/${encodeURIComponent(role)}`);
 }