Skip to content

Commit 4fafe75

Browse files
Non compliant package didn't fail validation (#6436)
1 parent 2563c63 commit 4fafe75

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/NuGetGallery/Security/RequirePackageMetadataCompliancePolicy.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ private bool IsPackageMetadataCompliant(Package package, State state, out IList<
116116

117117
// Author validation
118118
if (!package.FlattenedAuthors
119-
.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries)
119+
.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
120+
.Select(s => s.Trim())
120121
.Contains(state.RequiredCoOwnerUsername, StringComparer.InvariantCultureIgnoreCase))
121122
{
122123
complianceFailures.Add(string.Format(CultureInfo.CurrentCulture, Strings.SecurityPolicy_RequiredAuthorMissing, state.RequiredCoOwnerUsername));

tests/NuGetGallery.Facts/Security/RequirePackageMetadataCompliancePolicyFacts.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ public static IReadOnlyCollection<Package> CreateNonCompliantPackages()
335335

336336
// Ensure authors is non-compliant.
337337
var nonCompliantPackage4 = CreateCompliantPackage(version, newPackageRegistration);
338-
nonCompliantPackage4.FlattenedAuthors = "NuGet";
338+
nonCompliantPackage4.FlattenedAuthors = "Microsoft Communications Platform";
339339
nonCompliantPackages.Add(nonCompliantPackage4);
340340

341341
return nonCompliantPackages;

0 commit comments

Comments
 (0)