praeclarum / FuGetGallery

An alternative web UI for browsing nuget packages
https://www.fuget.org
MIT License
683 stars 121 forks source link

Int32 overflow due to download counts exceeding int32.maxvalue #176

Open joelverhagen opened 2 years ago

joelverhagen commented 2 years ago

I've noticed the following where when the search results include a package that has download counts greater than Int32.MaxValue.

Example URL: https://www.fuget.org/packages?q=newtonsoft.json

System.OverflowException: Value was either too large or too small for an Int32. at System.Convert.ThrowInt32OverflowException() at System.Convert.ToInt32(Int64 value) at System.Int64.System.IConvertible.ToInt32(IFormatProvider provider) at System.Convert.ToInt32(Object value, IFormatProvider provider) at Newtonsoft.Json.Linq.JToken.op_Explicit(JToken value) at FuGetGallery.PackagesSearchResults.Read(String json) in /home/runner/work/FuGetGallery/FuGetGallery/Data/PackagesSearchResults.cs:line 45 at FuGetGallery.PackagesSearchResults.ResultsCache.GetValueAsync(String q, HttpClient httpClient, CancellationToken token) in /home/runner/work/FuGetGallery/FuGetGallery/Data/PackagesSearchResults.cs:line 85

Other search results appear fine: https://www.fuget.org/packages?q=telerik

Details page works fine: https://www.fuget.org/packages/Newtonsoft.Json