Skip to content

Commit

Permalink
update registry
Browse files Browse the repository at this point in the history
  • Loading branch information
0xF6 committed Aug 31, 2024
1 parent 12328f6 commit 50f8f8f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/controllers/PackageContentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ public async Task<ActionResult<PackageVersionsResponse>> GetPackageVersionsAsync
[HttpGet("@/packages/{id}/{version}")]
public async Task<IActionResult> DownloadPackageAsync(string id, string version, CancellationToken cancellationToken)
{
var ver = version switch
{
"latest" or null => new (0, 0, 0, 0, "", "latest"),
"next" => new (0, 0, 0, 0, "", "next"),
not null => NuGetVersion.Parse(version)
};
if (version is ("latest" or "next"))
return BadRequest(new { message = "not allowed using latest or next version for this endpoint" });
if (NuGetVersion.TryParse(version, out var ver))
return BadRequest(new { message = "invalid version" });

var packageStream = await content.GetPackageContentStreamOrNullAsync(id, ver, cancellationToken);
if (packageStream == null)
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/SearchController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public async Task<ActionResult<Package>> FindByName(string name, string version,
? urlGenerator.GetPackageIconDownloadUrl(result.Name, result.Version)
: result.Icon;

if (!version!.Equals(Package.LatestTag) && !version.Equals(Package.NextTag))
if (version!.Equals(Package.LatestTag) || version.Equals(Package.NextTag))
return Json(result);

cache.Set((name, version), result, TimeSpan.FromDays(2));
Expand Down

0 comments on commit 50f8f8f

Please sign in to comment.