Skip to content

Commit

Permalink
Clean
Browse files Browse the repository at this point in the history
  • Loading branch information
loic-sharma committed Jul 26, 2021
1 parent 7865c6d commit c043aca
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/NuGetGallery/UrlHelperExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,22 +229,17 @@ public static string Package(
bool preview = false)
{
var normalized = (version != null) ? NuGetVersionFormatter.Normalize(version) : version;
var routeValues = new RouteValueDictionary
{
{ "id", id },
{ "version", normalized }
};

if (preview)
{
routeValues["preview"] = "1";
}

var result = GetRouteLink(
url,
RouteName.DisplayPackage,
relativeUrl,
routeValues);
routeValues: new RouteValueDictionary
{
{ "id", id },
{ "version", normalized },
{ "preview", preview ? "1" : null }
});

// Ensure trailing slashes for versionless package URLs, as a fix for package filenames that look like known file extensions
return version == null ? EnsureTrailingSlash(result) : result;
Expand Down

0 comments on commit c043aca

Please sign in to comment.