AngleSharp / AngleSharp.Diffing

A library that makes it possible to compare two AngleSharp node lists and get a list of differences between them.
MIT License
37 stars 6 forks source link

NuGet package "Part URI cannot start with two forward slashes." error #40

Open whyleee opened 8 months ago

whyleee commented 8 months ago

Bug Report

Prerequisites

For more information, see the CONTRIBUTING guide.

Description

We get a NuGet error when pushing latest "anglesharp.diffing.0.18.2.nupkg" package to our private NuGet feed in AppVeyor:

NuGet package cannot be read: Part URI cannot start with two forward slashes.

I found exactly same issue with another package: https://github.com/dotnet/aspnet-api-versioning/issues/637.

[Content_Types].xml file in "anglesharp.diffing.0.18.2.nupkg" package has the same problem with LICENSE file:

<?xml version="1.0" encoding="utf-8"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
  <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
  <Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
  <Default Extension="dll" ContentType="application/octet" />
  <Default Extension="xml" ContentType="application/octet" />
  <Default Extension="png" ContentType="application/octet" />
  <Default Extension="nuspec" ContentType="application/octet" />
  <Override PartName="//LICENSE" ContentType="application/octet" />
</Types>

Looking into another AngleSharp package "anglesharp.css.0.17.0" (also latest version) [Content_Types].xml file contents doesn't reveal this issue:

<?xml version="1.0" encoding="utf-8"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
  <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
  <Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
  <Default Extension="dll" ContentType="application/octet" />
  <Default Extension="png" ContentType="application/octet" />
  <Default Extension="xml" ContentType="application/octet" />
  <Default Extension="md" ContentType="application/octet" />
  <Default Extension="nuspec" ContentType="application/octet" />
</Types>

Could you please fix NuGet package build, so it produces the valid metadata?

Steps to Reproduce

We use AppVeyor NuGet Push-AppveyorArtifact helper to push NuGet packages to the private feed (https://www.appveyor.com/docs/packaging-artifacts/#pushing-artifacts-from-scripts):

Push-AppveyorArtifact anglesharp.diffing.0.18.2.nupkg

More simple way to test:

  1. Extract "anglesharp.diffing.0.18.2.nupkg" as a zip file into a folder
  2. Open [Content_Types].xml file in the extracted folder

Expected behavior: no <Override PartName="//LICENSE" ContentType="application/octet" /> element.

Actual behavior: <Override PartName="//LICENSE" ContentType="application/octet" /> is present and breaks NuGet push.

Environment details: reproduced at least in current AppVeyor environment that pushes NuGet packages with Push-AppveyorArtifact PowerShell cmdlet.

Possible Solution

AngleSharp and AngleSharp.Css NuGet packages are ok - it seems AngleSharp.Diffing build script could be aligned with those projects to fix the issue.

egil commented 8 months ago

@FlorianRappl does this ring a bell for you?

FlorianRappl commented 8 months ago

No - it also seems to be exclusive to AngleSharp.Diffing.

If standard publish to NuGet.org works then I wonder if the issue might actually be with the NuGet feed of AppVeyor? Why open the bug here?

whyleee commented 8 months ago

The issue seems to be with older NuGet tools which are most probably upgraded in NuGet.org. The similar https://github.com/dotnet/aspnet-api-versioning/issues/637 issue also mentioned NuGet Package Explorer didn't work at the time, although the latest version works for me.

//LICENSE inclusion in [Content_Types].xml looks like an error in NuGet package that may be tolerated by some NuGet tools.

I see AngleSharp and AngleSharp.Css NuGet packages doesn't include LICENSE file, but AngleSharp.Diffing includes it. Does it makes sense to exclude this LICENSE file? This will align this package with others and fix support for older NuGet tools.

FlorianRappl commented 8 months ago

Yeah I think that should be possible - but its up to @egil (the other projects still refer to the license via the URL etc.).

Also maybe it makes sense now to release a 1.0 with a reference to AngleSharp 1.0 and the AngleSharp.Css 1.0 preview package?

egil commented 8 months ago

Yeah I think that should be possible - but its up to @egil (the other projects still refer to the license via the URL etc.).

I have no preference here. Think you set up the deployment and build stuff here too, so I'm happy to be in sync with what the other anglesharp libs are doing.

Also maybe it makes sense now to release a 1.0 with a reference to AngleSharp 1.0 and the AngleSharp.Css 1.0 preview package?

Is it allow to release a none preview package that depends on a preview package? Or is it just frowned upon?

If we are allowed to do so, then it's fine with me.

FlorianRappl commented 8 months ago

If we are allowed to do so, then it's fine with me.

You mean technically allowed? I think it is - it should be. We can just try.

egil commented 8 months ago

Let's try.

Can you help sync the build stuff to this repo. I have not used this setup before.

FlorianRappl commented 8 months ago

Yeah but not this week. I have time for this next week.

I'll take care of it - let's assign me here.

egil commented 8 months ago

Thank you Florian, much appreciated!