Daniel15 / simple-nuget-server

A very simple PHP NuGet server
MIT License
116 stars 43 forks source link

Remove the additional slash. #25

Closed rolfwessels closed 6 years ago

rolfwessels commented 6 years ago

The base should be 'https://nuget.xxxxxxxxxxxxxx.com/' and not 'http://nuget.xxxxxxxxxxxxxx.com//.' It seems to be the double slash at the end that is breaking the request.

Nuget tries to resolve it to Resolved actions to install package 'xxxxxxxxxx.5.1.0.47-develop' GET http://nuget.xxxxxxxxxxxxxx.com//download/xxxxxxxxxx/5.1.0.47-develop

When I call that directly I only a response Only DELETEs allowed here. If I remove the double slash it works.

Daniel15 commented 6 years ago

I think it should actually check if dirname($_SERVER['REQUEST_URI']) ends in /. Omitting the slash won't work if it's in a subdirectory (eg. http://xxxxxx.com/nuget/download/....)

This is likely a better fix:

-           dirname($_SERVER['REQUEST_URI']) . '/';
+           rtrim(dirname($_SERVER['REQUEST_URI']), '/') . '/';

Would you be willing to test that out and update this PR?

rolfwessels commented 6 years ago

Makes sense. Will test it out.

rolfwessels commented 6 years ago

It worked for me.