Skip to content

Serve NuGet sources that are local folders or network shares - #5435

Open
Gabriel Dufresne (GabrielDuf) wants to merge 2 commits into
mainfrom
fix/5426-nuget-local-folder-feeds
Open

Gabriel Dufresne (GabrielDuf) wants to merge 2 commits into
mainfrom
fix/5426-nuget-local-folder-feeds

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

This pull request adds comprehensive support for local folder-based NuGet feeds throughout the codebase. It introduces detection and handling for local folder feeds, allowing package search, details, updates, icons, and versions to be retrieved directly from disk, bypassing HTTP requests. Additionally, there are improvements to Chocolatey source parsing and small utility enhancements.

Local NuGet feed support:

  • Added detection for local folder feeds by checking if the source URL uses the file scheme; these feeds are now handled by NuGetLocalFeed and scanned up to three directories deep for packages.
  • Updated BaseNuGet and BaseNuGetDetailsHelper to support searching, retrieving package details, updates, available versions, and icons directly from local folder feeds. This includes new helper methods for local feed enumeration, manifest parsing, and dependency extraction. [1] [2] [3] [4] [5] [6] [7] [8]

Chocolatey source parsing improvements:

  • Improved parsing of Chocolatey sources to correctly handle and strip the "(Authenticated)" marker and robustly extract the source URL, preventing issues with authenticated feeds. [1] [2] [3] [4]

Utilities and bug fixes:

  • Enhanced Tools.GetFileSizeAsLong and Tools.GetFileName to handle file:// URLs, allowing local file size and name retrieval without HTTP requests. [1] [2]

These changes ensure seamless integration of local folder NuGet feeds, improving performance and reliability when working with packages stored on disk.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Critical file-copy and manifest-parsing risks remain, alongside multiple functional and performance issues in local-feed handling.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 2 High severity · 2 Medium severity

Open (4)
What changed in this PR

Adds local-folder and network-share support for NuGet feeds, including package discovery, metadata, updates, versions, icons, downloads, and improved Chocolatey source parsing.

Changes:

  • Adds local .nupkg enumeration, caching, and manifest parsing.
  • Integrates local feeds into NuGet search, details, updates, versions, icons, and downloads.
  • Improves Chocolatey source parsing, file-URI utilities, tests, fixtures, and documentation.
File Description
src/​UniGetUI.PackageEngine.Tests/​NuGetLocalFeedTests.cs Tests local NuGet feed behavior.
src/​UniGetUI.PackageEngine.Tests/​Infrastructure/​Builders/​LocalNuGetFeedBuilder.cs Builds temporary local-feed packages for tests.
src/​UniGetUI.PackageEngine.Tests/​Fixtures/​Chocolatey/​source-list-output.txt Adds local and authenticated Chocolatey source fixtures.
src/​UniGetUI.PackageEngine.Tests/​DownloadOperationProgressTests.cs Tests local installer copying.
src/​UniGetUI.PackageEngine.Tests/​ChocolateyManagerTests.cs Tests Chocolatey source parsing and local searches.
src/​UniGetUI.PackageEngine.Operations/​DownloadOperation.cs Copies file-based installers directly; requires a same-file guard.
src/​UniGetUI.PackageEngine.Managers.Generic.NuGet/​Internal/​NuGetLocalFeed.cs Implements local package discovery, caching, and metadata parsing; has security, performance, icon, cache-key, and symbol-package issues.
src/​UniGetUI.PackageEngine.Managers.Generic.NuGet/​BaseNuGetDetailsHelper.cs Loads local metadata, icons, and versions; embedded icons and Chocolatey local versions remain unsupported.
src/​UniGetUI.PackageEngine.Managers.Generic.NuGet/​BaseNuGet.cs Adds local search and updates; PowerShell source parsing does not reliably preserve local or UNC paths.
src/​UniGetUI.PackageEngine.Managers.Chocolatey/​Helpers/​ChocolateySourceHelper.cs Improves authenticated and filesystem source parsing.
src/​UniGetUI.Core.Tools/​Tools.cs Adds file-URI size and filename handling.
AGENTS.md Documents local-feed behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/UniGetUI.PackageEngine.Managers.Generic.NuGet/Internal/NuGetLocalFeed.cs Outdated
Comment thread src/UniGetUI.PackageEngine.Operations/DownloadOperation.cs
Comment thread src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGetDetailsHelper.cs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Multiple moderate issues remain in source discovery, update filtering, icon handling and caching, path cache keys, and symbol-package exclusion.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (4)
Previously missed (1)

In code that hasn't changed since last review

Medium severity PowerShell managers cannot dispatch local or UNC NuGet feeds

src/​UniGetUI.PackageEngine.Managers.Generic.NuGet/​BaseNuGet.cs:124

This dispatch is unreachable for local repositories exposed by the two PowerShell managers. PowerShell7SourceHelper.cs:112-120 accepts only URLs matching https?://, while PowerShellSourceHelper.cs:104-112 truncates a filesystem location at its first space. Consequently, local/UNC feeds (including paths like C:\Shared Packages) cannot be searched through those NuGet-backed managers. Please emit a structured or explicitly delimited repository listing and preserve the complete location in both source helpers.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

A critical unsafe local-file copy path and several moderate correctness and cache issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity · 1 Low severity

Open (4)
Resolved since last review (1)

Comment on lines +123 to +127
using HttpClient? httpClient = downloadUrl.IsFile ? null : CreateHttpClient();
using HttpResponseMessage? response =
httpClient is null
? null
: await httpClient.GetAsync(
Comment on lines +119 to +124
if (NuGetLocalFeed.TryGetDirectory(source, out string localDirectory))
{
Packages.AddRange(
FindPackagesLocal(source, localDirectory, query, canPrerelease, logger)
);
continue;
Comment on lines +48 to +49
private static readonly ConcurrentDictionary<string, CacheEntry> ParsedPackages =
new(StringComparer.OrdinalIgnoreCase);
Comment on lines +14 to +15
public sealed class NuGetLocalFeedTests
{

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants