Hi,
I am using the SonarQube 5.2 Rest API to create and query groups. My group names contain underscores e.g. "my_group".
A call to "/api/user_groups/search" finds this group. A call to "/api/user_groups/search?q=my_group" returns zero groups.
I traced the call in the sonarqube sources.
The GroupDao seems to escape undersores in the query. But the GroupMapper.xml does not declare an escape character in the query.
Possible solution:
Add "ESCAPE '/'" to the query. See also the correct implementation in GroupMembershipMapper.xml.
Maybe this is an issue for other like queries.
suggestion for changes in GroupMapper.xml:
<select id="selectByQuery" parameterType="map" resultType="Group">
SELECT
<include refid="groupColumns"/>
FROM groups g
WHERE UPPER(g.name) LIKE #{query} ESCAPE '/'
ORDER BY UPPER(g.name)
</select>
Please fix this bug.
Thank You!
Michael