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

Nuget "Part URI cannot start with two forward slashes." #637

Closed
GJBos opened this issue Jun 4, 2020 · 3 comments
Closed

Nuget "Part URI cannot start with two forward slashes." #637

GJBos opened this issue Jun 4, 2020 · 3 comments
Assignees
Milestone

Comments

@GJBos
Copy link

GJBos commented Jun 4, 2020

When uploading the package to our server, or when opening the package in a NuGet Package explorer the error "Part URI cannot start with two forward slashes." is shown.

Stacktrace when uploading to our nuget server:

<?xml version="1.0" encoding="UTF-8"?>

-<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

<m:code/>

<m:message xml:lang="en-US">An error has occurred.</m:message>


-<m:innererror>

<m:message>Part URI cannot start with two forward slashes.</m:message>

<m:type>System.ArgumentException</m:type>

<m:stacktrace> at System.IO.Packaging.PackUriHelper.ValidatePartUri(Uri partUri) at System.IO.Packaging.ZipPackage.ContentTypeHelper.ProcessOverrideTagAttributes(XmlTextReader reader) at System.IO.Packaging.ZipPackage.ContentTypeHelper.ParseContentTypesFile(ZipFileInfoCollection zipFiles) at System.IO.Packaging.ZipPackage.ContentTypeHelper..ctor(ZipArchive zipArchive, IgnoredItemHelper ignoredItemHelper) at System.IO.Packaging.ZipPackage..ctor(Stream s, FileMode mode, FileAccess access, Boolean streaming) at System.IO.Packaging.Package.Open(Stream stream, FileMode packageMode, FileAccess packageAccess, Boolean streaming) at NuGet.PackageHelper.GetManifestStream(Stream packageStream) at NuGet.OptimizedZipPackage.EnsureManifest() at NuGet.Server.Core.PackageFactory.Open(String fullPackagePath) at NuGet.Server.Core.Infrastructure.ServerPackageRepository.AddPackagesFromDropFolderWithoutLocking() at NuGet.Server.Core.Infrastructure.ServerPackageRepository.<RebuildPackageStoreWithoutLockingAsync>d__48.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.Server.Core.Infrastructure.ServerPackageRepository.<RebuildIfNeededAsync>d__37.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.Server.Core.Infrastructure.ServerPackageRepository.<GetPackagesAsync>d__36.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at NuGet.Server.V2.Controllers.NuGetODataController.<Get>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__3`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()</m:stacktrace>

</m:innererror>

</m:error>

The issue seems to be the double // in the [Content_Types].xml file.
<Override PartName="//LICENSE" ContentType="application/octet" />

I had to remove this file from the nuget and repackage the nuget before I could upload the package to our server. I tried to find the error and submit a fix, but I cannot find the problem.

This error occures in both the Microsoft.AspNet.WebApi.Versioning.ApiExplorer and Microsoft.AspNet.WebApi.Versioning package

@Forgind
Copy link
Member

Forgind commented Jul 20, 2020

AB#1158131 (internal link) linked to this bug as the underlying issue. It looks like a problem in Contrib.Nuget to me.

@commonsensesoftware
Copy link
Collaborator

This is the same issue as #587. It's caused by the NuGet tools when they pack files without an extension. The license file was the culprit. I've added an extension to that file. I'll leave this open until the next patch is published. It will contain the fix.

@commonsensesoftware commonsensesoftware added this to the 4.2.0 milestone Oct 4, 2020
@commonsensesoftware
Copy link
Collaborator

This issue is now resolved in the latest RC packages. The Web API variants are very stable with few changes. The RC status is merely parity with the other libraries at the moment. The official release will like occur within the next 2 weeks. There are no additional changes expected. The RC version will be fully supported if that's an issue; otherwise, official package will put this to bed for good soon. Thanks.

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

No branches or pull requests

3 participants