Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private static string[] ExpandLocalFeed(string[] sourceFeedOverrides, string bas
string[] localFeedsThatIsRooted = new string[sourceFeedOverrides.Length];
for (int index = 0; index < sourceFeedOverrides.Length; index++)
{
string feed = sourceFeedOverrides[index];
string feed = sourceFeedOverrides[index].Trim();
if (!Uri.IsWellFormedUriString(feed, UriKind.Absolute) && !Path.IsPathRooted(feed))
{
localFeedsThatIsRooted[index] = Path.GetFullPath(feed, basePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ public async Task GivenASourceInstallSucceeds()
packagePath.Should().Contain(_tempDirectory.Value, "Package should be downloaded to the input folder");
}

[Fact]
public async Task GivenSourceWithLeadingWhitespaceInstallSucceeds()
{
string packagePath = await _installer.DownloadPackageAsync(
TestPackageId,
new NuGetVersion(TestPackageVersion),
new PackageSourceLocation(sourceFeedOverrides: new[] { " " + GetTestLocalFeedPath() })); // Leading space
File.Exists(packagePath).Should().BeTrue();
packagePath.Should().Contain(_tempDirectory.Value, "Package should be downloaded to the input folder");
}

[Fact]
public async Task GivenAFailedSourceItShouldError()
{
Expand Down Expand Up @@ -228,6 +239,19 @@ public async Task WhenPassedIncludePreviewItInstallSucceeds()
"Package should download higher package version");
}

[Fact]
public async Task GivenAdditionalSourceWithLeadingWhitespaceInstallSucceeds()
{
string getTestLocalFeedPath = GetTestLocalFeedPath();
string relativePath = Path.GetRelativePath(Environment.CurrentDirectory, getTestLocalFeedPath);
string packagePath = await _installer.DownloadPackageAsync(
TestPackageId,
new NuGetVersion(TestPackageVersion),
new PackageSourceLocation(additionalSourceFeeds: new[] { " " + relativePath })); // Leading space
File.Exists(packagePath).Should().BeTrue();
packagePath.Should().Contain(_tempDirectory.Value, "Package should be downloaded to the input folder");
}

[WindowsOnlyFact]
public async Task GivenANonSignedSdkItShouldPrintMessageOnce()
{
Expand Down