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

It may be better if the base URL ends in /. #153

Open
toras9000 opened this issue Jun 11, 2024 · 1 comment · May be fixed by #207
Open

It may be better if the base URL ends in /. #153

toras9000 opened this issue Jun 11, 2024 · 1 comment · May be fixed by #207
Assignees

Comments

@toras9000
Copy link

Proposal

I think that it is better for service resource URLs included in the package's service index that are used as base URLs to end in /.
Specifically, it refers to the following.

return AbsoluteUrl("v3/package");

return AbsoluteUrl("v3/registration");

Reasons for Proposal

It may depend on the application implementation, but if the base URL is not terminated with a /, it may result in a different URL than expected when combined with a relative URL.
For example, if you use the .NET Uri class as it is, the following differences will appear depending on the presence or absence of the trailing /.

var baseUri1 = new Uri("http://server.example/v3/package");
var fullUri1 = new Uri(baseUri1, "relative/path");
// fullUri1.AbsoluteUri is "http://server.example/v3/relative/path"

var baseUri2 = new Uri("http://server.example/v3/package/");
var fullUri2 = new Uri(baseUri2, "relative/path");
// fullUri2.AbsoluteUri is "http://server.example/v3/package/relative/path"

I think something similar could happen outside of .NET Uri.
I believe that terminating the base URL with a / will reduce the likelihood of encountering such handling problems.
Note that the index https://api.nuget.org/v3/index.json on nuget.org also terminates the addresses of PackageBaseAddress and PackageBaseAddress with a /.

I can give one specific example of an application that encounters the above mentioned problem.
The following extension cannot display package information correctly when using the Bagetter v1.4.2 service index.
Based on my research into the operation of this application I have made the above suggestions.
https://marketplace.visualstudio.com/items?itemName=FullStackSpider.visual-nuget

etc.

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

@Regenhardt
Copy link

Thanks for the proposal. I Agree that the v3 endpoints should be terminated with / like the ones on nuget.org. Will get to it eventually, but I'd appreciate any PR amending the v3 endpoints as well, as I don't have much time currently.

@toras9000 toras9000 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 10, 2024
@Regenhardt Regenhardt reopened this Jan 2, 2025
@Regenhardt Regenhardt self-assigned this Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants