Skip to content

Commit

Permalink
make support request issues prioritize normalized version
Browse files Browse the repository at this point in the history
  • Loading branch information
drewgillies committed Oct 27, 2022
1 parent a6706cb commit 45d1baa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
11 changes: 11 additions & 0 deletions src/NuGetGallery.Core/NuGetVersionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Text.RegularExpressions;
using NuGet.Services.Entities;
using NuGet.Versioning;

namespace NuGetGallery
Expand Down Expand Up @@ -31,6 +32,16 @@ public static string ToFullString(string version)
return version;
}
}

public static string GetNormalizedPackageVersion(Package package)
{
if (package == null)
{
return string.Empty;
}

return string.IsNullOrEmpty(package.NormalizedVersion) ? Normalize(package.Version) : package.NormalizedVersion;
}
}

public static class NuGetVersionExtensions
Expand Down
5 changes: 2 additions & 3 deletions src/NuGetGallery.Core/Services/FIleNameHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ public static string BuildFileName(Package package, string format, string exten

return BuildFileName(
package.PackageRegistration.Id,
string.IsNullOrEmpty(package.NormalizedVersion) ?
NuGetVersionFormatter.Normalize(package.Version) :
package.NormalizedVersion, format, extension);
NuGetVersionFormatter.GetNormalizedPackageVersion(package),
format, extension);
}

public static string BuildFileName(string id, string version, string pathTemplate, string extension)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
using NuGet.Packaging.Signing;
using NuGet.Services.Entities;
using NuGetGallery.Areas.Admin.Models;
using NuGetGallery.Auditing;
Expand Down Expand Up @@ -201,7 +202,7 @@ public async Task UpdateIssueAsync(int issueId, int? assignedToId, int issueStat
newIssue.CreatedBy = loggedInUser;
newIssue.OwnerEmail = requestorEmailAddress;
newIssue.PackageId = package?.PackageRegistration.Id;
newIssue.PackageVersion = package?.Version;
newIssue.PackageVersion = NuGetVersionFormatter.GetNormalizedPackageVersion(package);
newIssue.Reason = reason;
newIssue.SiteRoot = _siteRoot;
newIssue.UserKey = user?.Key;
Expand Down

0 comments on commit 45d1baa

Please sign in to comment.