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.org Bug]: Embedded license page returns HTTP 500 when the URL does not have version #9295

Closed
joelverhagen opened this issue Nov 3, 2022 · 1 comment

Comments

@joelverhagen
Copy link
Member

joelverhagen commented Nov 3, 2022

Impact

It bothers me. A fix would be nice

Describe the bug

If someone handcrafts the https://www.nuget.org/packages/{id}/license URL pattern with a package ID but no package version, and HTTP 500 is returned. We don't link to this page directly (AFAIK) so it's not a huge deal, but we should either 404 or show the version information of the latest package.

System.ArgumentException: version
   at NuGetGallery.CorePackageService.FindPackageByIdAndVersionStrict(String id, String version) in D:\a\_work\1\s\src\Gallery\submodules\Gallery\src\NuGetGallery.Core\Services\CorePackageService.cs:line 226
   at NuGetGallery.PackagesController.<License>d__68.MoveNext() in D:\a\_work\1\s\src\Gallery\submodules\Gallery\src\NuGetGallery\Controllers\PackagesController.cs:line 1175
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)

Repro Steps

Compare the output of these 2 URLs:

https://www.nuget.org/packages/newtonsoft.json/license

HTTP 500

https://www.nuget.org/packages/newtonsoft.json/13.0.1/license

WORKS

Expected Behavior

It should return a 404 or show the license for the latest version, similar to how https://www.nuget.org/packages/{id} shows the package details page for the latest version.

Screenshots

image

Additional Context and logs

No response

@joelverhagen
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant