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

Can't download package with '+' in version string from TeamCity #2261

Closed
bigbearzhu opened this issue Apr 19, 2017 · 3 comments · Fixed by #2288
Closed

Can't download package with '+' in version string from TeamCity #2261

bigbearzhu opened this issue Apr 19, 2017 · 3 comments · Fixed by #2288

Comments

@bigbearzhu
Copy link

Description

We used SemVer 2.0 versioning for some of our package. e.g. the package name could be: MyPackage.1.2.0-master+aaabbb.nupkg.

The metadata section was recently added to the package. When it was not there, paket worked fine. However, when we tried to add the metadata section with '+', paket update failed with 404 return from TeamCity. See the stacktrace below.

What I found is that the url does return 404 when manually accessed, however, it was just because the '+' was not escaped to %2B. If I change the url to http://TeamCity/guestAuth/app/nuget/v1/FeedService.svc/download/WebServices_NuGetPackage/36664:id/MyPackage.1.2.0-master%2Baaabbb.nupkg TeamCity returns the package fine. Sounds like we should escape the url?

Paket failed with:
        Could not download MyPackage.1.2.0-master+aaabbb from http://TeamCity/guestAuth/app/nuget/v1/FeedService.svc/download/WebServices_NuGetPackage/36664:id/MyPackage.1.2.0-master+aaabbb.nupkg.
    The remote server returned an error: (404) Not Found.
StackTrace:
     at [email protected](String message)
   at [email protected](Exception _arg10)
   at [email protected](AsyncParams`1 args)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.FSharp.Control.AsyncBuilderImpl.commit[a](AsyncImplResult`1 res)
   at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronouslyInAnotherThread[a](CancellationToken token, FSharpAsync`1 computation, FSharpOption`1 timeout)
   at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously[a](CancellationToken token, FSharpAsync`1 computation, FSharpOption`1 timeout)
   at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken)
   at [email protected](b& )
   at Microsoft.FSharp.Collections.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext()
   at Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.takeOuter@683[T,TResult](ConcatEnumerator`2 x, Unit unitVar0)
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at Microsoft.FSharp.Collections.SeqModule.ToArray[T](IEnumerable`1 source)
   at Paket.InstallProcess.InstallIntoProjects[a](InstallerOptions options, Boolean forceTouch, DependenciesFile dependenciesFile, LockFile lockFile, FSharpList`1 projectsAndReferences, FSharpMap`2 updatedGroups)
   at Paket.UpdateProcess.SmartInstall(DependenciesFile dependenciesFile, UpdateMode updateMode, UpdaterOptions options)
   at <StartupCode$Paket-Core>[email protected](Unit unitVar0)

   at Paket.Utils.RunInLockedAccessMode[a](String rootFolder, FSharpFunc`2 action)
   at [email protected](ParseResults`1 results)
   at Paket.Program.processWithValidation[T](Boolean silent, FSharpFunc`2 validateF, FSharpFunc`2 commandF, ParseResults`1 result)
   at Paket.Program.main$cont@420(ParseResults`1 results, Boolean silent, Boolean fromBootstrapper, Unit unitVar)
   at Paket.Program.main()

Repro steps

Please provide the steps required to reproduce the problem

  1. Create a package with name MyPackage.1.2.0-master+aaabbb.nupkg on TeamCity.

  2. Install the package using paket.

Expected behavior

Should install the package correctly.

Actual behavior

404 error and fail to install.

Known workarounds

No.

@forki forki closed this as completed in a46c0fd Apr 19, 2017
@bigbearzhu
Copy link
Author

Sorry with latest release 4.5.1, the issue seems still exists.

From the stack trace, the error was thrown in NuGetV2.download method, not the places where you have changed in commit a46c0fd. And also I would think it maybe better to be escaped when the url is just fetched, instead of when it is used.

let rec download authenticated attempt =

forki added a commit that referenced this issue Apr 24, 2017
This reverts commit a46c0fd.

Conflicts:
	RELEASE_NOTES.md
	src/Paket.Bootstrapper/Properties/AssemblyInfo.cs
	src/Paket.Core/AssemblyInfo.fs
	src/Paket.PowerShell/AssemblyInfo.fs
	src/Paket/AssemblyInfo.fs
@forki
Copy link
Member

forki commented Apr 24, 2017

I reverted it and tried 94560b5. can you please retry with 4.5.2 or send another potential fix?

@bigbearzhu
Copy link
Author

4.5.2 didn't fix the issue as Uri.IsWellFormedUriString at

if Uri.IsWellFormedUriString(nugetPackage.DownloadLink, UriKind.Absolute) then
returns true for the url with only + not encoded. I have created a pull request for the proper fix.

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

Successfully merging a pull request may close this issue.

2 participants