Prerelease flag doesn't work in the nuget search API
Summary
Using Visual Studio, in the Manage NuGet Packages
screen, the Show pre-release packages
checkbox doesn't work as expected.
Steps to reproduce
- Setup GitLab as a NuGet source as described in https://docs.gitlab.com/ee/user/packages/nuget_repository/index.html#adding-the-gitlab-nuget-repository-as-a-source-to-nuget
-
$ dotnet new console --name NugetBug
. -
$ cd NugetBug
. -
$ open NugetBug.csproj
. - Right click on
Dependencies
in the tree view and selectManage NuGet Packages
. - In the opening modal, select the GitLab source.
- Search for a package with a pre release version (eg. has a
-
in the version number). - Checking or not the
Show pre-release packages
checkbox doesn't have any effect: the pre release version is always shown.
What is the current bug behavior?
With the Show pre-release packages
checkbox ticked:
Without the Show pre-release packages
checkbox ticked:
-> the version 9.6.1-alpha
is always shown.
What is the expected correct behavior?
The pre release version are not listed when the Show pre-release packages
checkbox not ticked.
Output of checks
This bug happens on GitLab.com
Possible fixes
It might be possible that default option for including pre release version is take into account too aggressively and thus it is applied all the time: https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/services/packages/nuget/search_service.rb#L13.
In all cases, it should be really easy to fix it.