diff --git a/src/Paket.Core/NuGetV2.fs b/src/Paket.Core/NuGetV2.fs index 8537442433..477613dd4c 100644 --- a/src/Paket.Core/NuGetV2.fs +++ b/src/Paket.Core/NuGetV2.fs @@ -265,6 +265,9 @@ let getDetailsFromNuGetViaODataFast auth nugetURL (packageName:PackageName) (ver return parseODataDetails(url,nugetURL,packageName,version,raw) } +let urlSimilarToTfsOrVsts url = + String.containsIgnoreCase "visualstudio.com" url || (String.containsIgnoreCase "/_packaging/" url && String.containsIgnoreCase "/nuget/v" url) + /// Gets package details from NuGet via OData let getDetailsFromNuGetViaOData auth nugetURL (packageName:PackageName) (version:SemVerInfo) = let queryPackagesProtocol (packageName:PackageName) = @@ -293,8 +296,9 @@ let getDetailsFromNuGetViaOData auth nugetURL (packageName:PackageName) (version async { try let! result = getDetailsFromNuGetViaODataFast auth nugetURL packageName version - if String.containsIgnoreCase "visualstudio.com" nugetURL && result.Dependencies.IsEmpty then + if urlSimilarToTfsOrVsts nugetURL && result.Dependencies.IsEmpty then // TODO: There is a bug in VSTS, so we can't trust this protocol. Remvoe when VSTS is fixed + // TODO: TFS has the same bug return! queryPackagesProtocol packageName else return result @@ -679,7 +683,7 @@ let rec private getPackageDetails alternativeProjectRoot root force (sources:Pac match source with | NuGetV2 nugetSource -> return! tryV2 source nugetSource - | NuGetV3 nugetSource when nugetSource.Url.Contains("pkgs.visualstudio.com") -> + | NuGetV3 nugetSource when urlSimilarToTfsOrVsts nugetSource.Url -> match NuGetV3.calculateNuGet2Path nugetSource.Url with | Some url -> let nugetSource : NugetSource = diff --git a/src/Paket.Core/NuGetV3.fs b/src/Paket.Core/NuGetV3.fs index b95deaab70..1db804321e 100644 --- a/src/Paket.Core/NuGetV3.fs +++ b/src/Paket.Core/NuGetV3.fs @@ -41,6 +41,7 @@ let calculateNuGet3Path(nugetUrl:string) = | "http://www.nuget.org/api/v2" -> Some "http://api.nuget.org/v3/index.json" | "https://www.nuget.org/api/v2" -> Some "https://api.nuget.org/v3/index.json" | url when url.EndsWith("/nuget/v2") && url.Contains("pkgs.visualstudio.com") -> Some (url.Replace("/nuget/v2","/nuget/v3/index.json")) + | url when url.EndsWith("/nuget/v2") && url.Contains("/_packaging/") -> Some (url.Replace("/nuget/v2","/nuget/v3/index.json")) // TFS | url when url.EndsWith("api/v2") && url.Contains("visualstudio.com") -> Some (url.Replace("api/v2","api/v3/index.json")) | url when url.EndsWith("api/v2") && url.Contains("myget.org") -> Some (url.Replace("api/v2","api/v3/index.json")) | url when url.EndsWith("v3/index.json") -> Some url