API - projects/search?projects=. is case sensitive but projects/create is not?

Hello!

SonarQube Version - Data-Center Edition v10.3
Deployed through Zip

We rely on the APIs for most of our onboarding tasks. We have prechecks in our scripts which check if a project already exists. Recently when we tried to onboard a project, it went through our precheck but failed when creating the project.
During precheck, we use projects/search?projects=new-projects-name and if it exists the onboarding stops there and if it doesn’t we proceed and onboard the project.
New Project Key - NEWprojecT
Existing Project Key - newproject

projects/search?projects=NEWprojecT says this is a unique project but projects/create says this project already exists. So it looks like projects/search?projects=NEWprojecT is case sensitive but projects/create is not.

I know :sweat_smile: v10.4 is already released, but just wanted to know if anybody is already aware of this and if is this already fixed in v10.4.

Thanks,
Aravind

Hey there.

Even worse, when you create a project using the same key (different case) in the UI, it doesn’t fail the frontend check but fails when you try to create the project.

I’ll flag this for attention (I don’t expect this was addressed in v10.4)

Is this new behavior for you or has it alwasy been the case?

Hi @Colin,

Thanks for your response.

This is a coincidence. We have never faced such an issue before. Usually, Users request Sonar projects based on their repos and this time this user was unaware that she already had an Sonar project for that repo.

We also have a Community Edition Server running on v9.9.3. I can check once on that server as well.

Thanks,
Aravind

Update:

That seems to be the case with v9.9.3 as well.

So this is an existing project,

And when I try to create one(with different case) it behaves the same as in v10.4

I tried this through the UI and not through the APIs.

Thanks,
Aravind

Hey @aravindnss ,

Thanks for pointing that out, indeed there is an inconsistency.

To be fair I’m not so sure if that is a bug, as the search endpoint is intended to be used for well-searching projects and you would expect to find them using case-sensitive search.

However, I think your use case is still valid, and we could provide a parameter to make it case insensitive, as your use case makes sense.

I have created a ticket to improve the situation: SONAR-21933

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.