Skip to content

Commit

Permalink
fix bug in getLastNuGetVersion when result is in JSON.
Browse files Browse the repository at this point in the history
if multiple package hit the searchTerm, the correct one is not always selected.
  • Loading branch information
MaxDeg committed Mar 7, 2017
1 parent fed01fd commit 947ea4e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/FakeLib/NuGet/NugetVersion.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ open System.Xml
open System.Xml.Linq

type NuGetSearchItemResult =
{ Version:string
{ Id:string
Version:string
Published:DateTime }
type NuGetSearchResult =
{ results:NuGetSearchItemResult list }
Expand Down Expand Up @@ -59,6 +60,7 @@ let getLastNuGetVersion server (packageName:string) =
then
let json = JsonConvert.DeserializeObject<NuGetSearchResponse>(text)
json.d.results
|> Seq.filter (fun i -> i.Id = packageName)
|> Seq.sortByDescending (fun i -> i.Published)
|> Seq.tryHead
|> fun i ->
Expand Down

0 comments on commit 947ea4e

Please sign in to comment.