Error not loading the repository of a Bitbucket project whose name contains special characters

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    • Community Edition v10.5 (89998)[ACTIVE]
  • how is SonarQube deployed: zip, Docker, Helm

Hello, I am getting an error where my sonarqube cannot load the repository of a Bitbucket project whose name contains special characters (parentheses, braces, etc.).

After checking the log, it seems that there is a problem when encoding the query string when calling the bitbucket API.

https://sonarqube.mysonarqube.com/api/alm_integrations/search_bitbucketserver_repos?almSetting=bitbucket-server&projectName=%5B%EB%8C%80%EA%B3%A0%EA%B0%9D%5D%20ONE%20store%20IAA%20SDK

https://sonarqube.mysonarqube.com/api/alm_integrations/search_bitbucketserver_repos?almSetting=bitbucket-server&projectName=%5B%EB%B0%B1%EC%97%85%5D%20%EB%AF%B8%EC%82%AC%EC%9A%A9%20%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8%20Backup

https://sonarqube.mysonarqube.com/api/alm_integrations/search_bitbucketserver_repos?almSetting=bitbucket-server&projectName=%5B%EB%B3%B4%EC%95%88%5D%20%EC%95%94%EB%B3%B5%ED%98%B8%ED%99%94%20%ED%82%A4%EA%B4%80%EB%A6%AC%20%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8

The link above is the sonarqube API that was actually called.

Below is the access-log of bitbucket api called later.

172.xxx.xxx.xxx - - [22/Apr/2024:19:54:10 +0900] "GET /rest/api/1.0/repos?projectname=[%EB%8C%80%EA%B3%A0%EA%B0%9D]%20ONE%20store%20IAA%20SDK&name= HTTP/1.1" 400 1 5181 0 "-" "okhttp/4.12.0" bitbucket.mybitbucket.com

172.xxx.xxx.xxx - - [22/Apr/2024:19:54:10 +0900] "GET /rest/api/1.0/repos?projectname=[%EB%B0%B1%EC%97%85]%20%EB%AF%B8%EC%82%AC%EC%9A%A9%20%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8%20Backup&name= HTTP/1.1" 400 1 5310 0 "-" "okhttp/4.12.0" bitbucket.mybitbucket.com

172.xxx.xxx.xxx - - [22/Apr/2024:19:54:10 +0900] "GET /rest/api/1.0/repos?projectname=[%EB%8C%80%EA%B3%A0%EA%B0%9D]%20%EA%B0%9C%EB%B0%9C%EC%9E%90%20%EC%84%BC%ED%84%B0&name= HTTP/1.1" 400 1 5379 0 "-" "okhttp/4.12.0" bitbucket.mybitbucket.com

172.xxx.xxx.xxx - - [22/Apr/2024:19:54:10 +0900] "GET /rest/api/1.0/repos?projectname=[%EB%B3%B4%EC%95%88]%20%EC%95%94%EB%B3%B5%ED%98%B8%ED%99%94%20%ED%82%A4%EA%B4%80%EB%A6%AC%20%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8&name= HTTP/1.1" 400 1 5167 0 "-" "okhttp/4.12.0" bitbucket.mybitbucket.com

172.xxx.xxx.xxx - - [22/Apr/2024:19:57:46 +0900] "GET /rest/api/1.0/repos HTTP/1.1" 200 61 6925 0 "-" "okhttp/4.12.0" bitbucket.mybitbucket.com

172.xxx.xxx.xxx - - [22/Apr/2024:19:57:46 +0900] "GET /rest/api/1.0/users HTTP/1.1" 200 5895 288868 0 "-" "okhttp/4.12.0" bitbucket.mybitbucket.com

172.xxx.xxx.xxx - - [22/Apr/2024:19:57:47 +0900] "GET /rest/api/1.0/repos HTTP/1.1" 200 37219 295697 0 "-" "okhttp/4.12.0" bitbucket.mybitbucket.com

I think the source part below needs to be modified.

Please actively review. thank you

Is there no one help? :smiling_face_with_tear:

Hello @sh.yoon.devops

There is indeed a bug here, so I created SONAR-22207 to fix it.
We will likely not work on it right away, but you can use the workaround described in the ticket, and you’ll end up with the same result.

Cheers,
Antoine