bagetter / BaGetter

A lightweight NuGet and symbol server
https://www.bagetter.com
MIT License
166 stars 38 forks source link

Do not allow http schema in repository URLs #151

Open toras9000 opened 2 weeks ago

toras9000 commented 2 weeks ago

Describe the bug

When a package is uploaded, if the repository URL in the package information is http, the URL is not accepted.
Specifically, it is the URL indicated by the repository element of nuspec.

If you upload a package whose repository URL is htttp, the upload itself will succeed.
However, the Source code link that appears on the package page after upload is not the package's configuration, but the URL of the page itself.

I think this is due to the fact that the following code section compares only with Uri.UriSchemeHttps. https://github.com/bagetter/BaGetter/blob/0e744432d73248ce6bc458459ba074a404ad7391/src/BaGetter.Core/Extensions/PackageArchiveReaderExtensions.cs#L162

To Reproduce

  1. The target Bagetter version is v1.4.2.
  2. Create a package whose repository element is http.
  3. Perform a nuget push to Bagetter.
  4. Open the uploaded package page in browser.
    • The Source code link is not appropriate.

Expected behavior

Even if the repository URL is http, it will be properly linked.

I rely on translation tools. I'm sorry if there is a strange sentence.

Regenhardt commented 1 week ago

You're right, since BaGetter is being used internally too, there can be repositories hosted without https still. I don't have time for it right now, but I will review PRs or do it once I have some more time.