Skip to content

Commit 7398f80

Browse files
authored
Merge pull request #15109 from dependabot/dev/brettfo/nuget-empty-path
change test for file path to account for empty string
2 parents df981ab + 61e09cd commit 7398f80

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,12 +722,16 @@ PackageManagementKind.CentralPackageManagement or
722722
_ => null,
723723
};
724724

725-
if (packageManagementFile is not null)
725+
// If a repo has an incomplete setup of package management, it's possible we detect it but then get an
726+
// empty string for the special file path. The fix is to explicitly check for that and not just a null
727+
// value. A check below will then autocorrect to default package management since that's what's really
728+
// being used.
729+
if (!string.IsNullOrWhiteSpace(packageManagementFile))
726730
{
727731
packageManagementFile = Path.GetRelativePath(projectFullDirectory, packageManagementFile).NormalizePathToUnix();
728732
}
729733

730-
if (packageManagementKind != PackageManagementKind.Default && packageManagementFile is null)
734+
if (packageManagementKind != PackageManagementKind.Default && string.IsNullOrWhiteSpace(packageManagementFile))
731735
{
732736
logger.Warn($"Project [{projectRelativePath}] detected package management kind of {packageManagementKind} but no package management file found; forcing management kind to {PackageManagementKind.Default}.");
733737
packageManagementKind = PackageManagementKind.Default;

0 commit comments

Comments
 (0)