loic-sharma / BaGet

A lightweight NuGet and symbol server
https://loic-sharma.github.io/BaGet/
MIT License
2.58k stars 644 forks source link

AllowPackageOverwrites isn't applied on .snupkg #688

Open MithrilMan opened 2 years ago

MithrilMan commented 2 years ago

Describe the bug

The setting AllowPackageOverwrites ignore .snupkg . If you set AllowPackageOverwrites to false, updated packages on source symbols (.snupckg) are overwritten.

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of BaGet '0.0.0-preview5'
  2. Setup a project to generate packages with any version with source generator included. e.g.

    <PropertyGroup>
        <!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
        <EmbedUntrackedSources>true</EmbedUntrackedSources>
    
        <!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
        <IncludeSymbols>true</IncludeSymbols>
        <SymbolPackageFormat>snupkg</SymbolPackageFormat>
    </PropertyGroup>
  3. Publish nuget with a command like dotnet nuget push $(NupkgSourceDir) --skip-duplicate --api-key $(NuGetKey) --source $(NuGetServer)
  4. both packages should be correctly updated
  5. try to upload a second time, now the .nupkg will be rejected correctly (conflict) but the .snupkg will be updated

Expected behavior

.snupkg should be rejected too