Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Paket.Core/Versioning/PackageSources.fs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ type PackageSource =
#endif
LocalNuGet(source,None)
else
if String.endsWithIgnoreCase "v3/index.json" source then
if Regex("/v3(?:/[-\w]+)?/index.json$").IsMatch source then
NuGetV3 { Url = source; Authentication = auth }
else
NuGetV2 { Url = source; Authentication = auth }
Expand Down
1 change: 1 addition & 0 deletions tests/Paket.Tests/Paket.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<Paket>True</Paket>
<Link>FsUnit.fs</Link>
</Compile>
<Compile Include="Versioning\PackageSourceSpecs.fs" />
<None Include="paket.references" />
<Compile Include="AssemblyInfo.fs" />
<Compile Include="TestHelpers.fs" />
Expand Down
40 changes: 40 additions & 0 deletions tests/Paket.Tests/Versioning/PackageSourceSpecs.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module Paket.PackageSourceSpecs

open Paket
open NUnit.Framework
open FsUnit
open Paket.Domain
open Paket.PackageSources

[<TestCase("https://nuget.org/api/v2")>]
[<TestCase("https://nuget.org/api/v2/")>]
[<TestCase("https://www.myget.org/F/roslyn-tools/")>]
[<TestCase("http://my.domain/artifactory/api/nuget/nugetsource/")>]
[<TestCase("http://my.domain/artifactory/api/nuget/nuget-local/")>]
[<TestCase("http://my.domain/artifactory/api/nuget/nuget_proxy/")>]
let ``should parse known nuget2 source``(feed : string) =
let line = sprintf "source %s" feed
match PackageSource.Parse(line) with
| NuGetV2 { Url = source; Authentication = _ } ->
let quoted = sprintf "source \"%s\"" feed
match PackageSource.Parse(quoted) with
| NuGetV2 { Url = qsource; Authentication = _ } ->
source |> shouldEqual qsource
| _ -> failwith quoted
| _ -> failwith feed

[<TestCase("https://api.nuget.org/v3/index.json")>]
[<TestCase("https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json")>]
[<TestCase("http://my.domain/artifactory/api/nuget/v3/nugetsource/index.json")>]
[<TestCase("http://my.domain/artifactory/api/nuget/v3/nuget-local/index.json")>]
[<TestCase("http://my.domain/artifactory/api/nuget/v3/nuget_proxy/index.json")>]
let ``should parse known nuget3 source``(feed : string) =
let line = sprintf "source %s" feed
match PackageSource.Parse(line) with
| NuGetV3 { Url = source; Authentication = _ } ->
let quoted = sprintf "source \"%s\"" feed
match PackageSource.Parse(quoted) with
| NuGetV3 { Url = qsource; Authentication = _ } ->
source |> shouldEqual qsource
| _ -> failwith quoted
| _ -> failwith feed