Skip to content

Commit b46c972

Browse files
committed
(#3641) Ensure root drive sources can be identified
1 parent 6d82bc0 commit b46c972

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/chocolatey/infrastructure.app/nuget/NugetCommon.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using System.Collections.Concurrent;
1919
using System.Collections.Generic;
2020
using System.ComponentModel;
21+
using System.IO;
2122
using System.Linq;
2223
using System.Net;
2324
using System.Security.Cryptography.X509Certificates;
@@ -253,6 +254,13 @@ public static IEnumerable<SourceRepository> GetRemoteRepositories(ChocolateyConf
253254
// If an invalid source was passed in, we don't care here, pass it along
254255
fullsource = source;
255256
}
257+
258+
// filesystem.GetFullPath sometimes resolves to `C:` instead of `C:\` which PackageSource can't handle. This corrects for that edge case.
259+
if (fullsource.EndsWith(":"))
260+
{
261+
fullsource += Path.DirectorySeparatorChar;
262+
}
263+
256264
nugetSource = new PackageSource(fullsource);
257265

258266
if (!nugetSource.IsLocal)

0 commit comments

Comments
 (0)