Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuget NotFound package with version suffex like (1.0.0-rc.1+r12345.26a7053f) #22178

Closed
m2nlight opened this issue Dec 20, 2022 · 3 comments · Fixed by #22186
Closed

Nuget NotFound package with version suffex like (1.0.0-rc.1+r12345.26a7053f) #22178

m2nlight opened this issue Dec 20, 2022 · 3 comments · Fixed by #22186

Comments

@m2nlight
Copy link

m2nlight commented Dec 20, 2022

Description

We always make nupkg files to append VCS version like 1.0.0-rc.1+r12345.26a7053f

The gitea nuget repo page (ex: http://gitea:3000/testorg/-/packages/nuget/test.pkg.scanner/1.0.0-rc.1+r12345.26a7053f) is okey.
And the tip info:

dotnet add package --source Gitea --version 1.0.0-rc.1+r12345.26a7053f Test.Pkg.Scanner

VS2022 get some errors when restore this package:

GET http://gitea:3000/api/packages/testorg/nuget/package/test.pkg.scanner/index.json
OK http://gitea:3000/api/packages/testorg/nuget/package/test.pkg.scanner/index.json 921 ms
GET http://gitea:3000/api/packages/testorg/nuget/package/test.pkg.scanner/1.0.0-rc.1/test.pkg.scanner.1.0.0-rc.1.nupkg
NotFound http://gitea:3000/api/packages/testorg/nuget/package/test.pkg.scanner/1.0.0-rc.1/test.pkg.scanner.1.0.0-rc.1.nupkg 303 ms
...

I got that from the index.json

{"versions":["1.0.0-rc.1","1.0.0-preview.1"]}

I guess real package address is http://gitea:3000/api/packages/testorg/nuget/package/test.pkg.scanner/1.0.0-rc.1/test.pkg.scanner.1.0.0-rc.1+r12345.26a7053f.nupkg

The index.json should be

{"versions":["1.0.0-rc.1+r12345.26a7053f","1.0.0-preview.1"]}

Gitea Version

1.18.0+rc1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

gitea in docker

Database

None

@KN4CK3R
Copy link
Member

KN4CK3R commented Dec 20, 2022

Thanks for reporting. It's a bit tricky because the array should contain the "normalized versions" (https://learn.microsoft.com/en-us/nuget/api/package-base-address-resource#response) The following request with this version fails because the registry only knows about the non-normalized version. Now the question is how to fix it. If I allow multiple versions with different metadata, it's not clear which version should be presented to the caller because the metadata part is missing. So my current solution would be to normalize the version when uploading a package which would prevent the error but only allow one normalized version. Do you know how other registries handle this?

@m2nlight
Copy link
Author

Thanks!

We don't like tricky. I will pack normalized version files until there is the right solution.

@m2nlight
Copy link
Author

I check again, and found this.

I upload nupkg filename: test.pkg.scanner.1.0.0-rc.1.nupkg
But, gitea link filename: test.pkg.scanner.1.0.0-rc.1+r12345.26a7053f.nupkg

techknowlogick pushed a commit that referenced this issue Dec 21, 2022
Fixes #22178

After this change upload versions with different semver metadata are
treated as the same version and trigger a duplicated version error.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
KN4CK3R added a commit to KN4CK3R/gitea that referenced this issue Dec 21, 2022
Fixes go-gitea#22178

After this change upload versions with different semver metadata are
treated as the same version and trigger a duplicated version error.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
KN4CK3R added a commit to KN4CK3R/gitea that referenced this issue Dec 21, 2022
Fixes go-gitea#22178

After this change upload versions with different semver metadata are
treated as the same version and trigger a duplicated version error.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants