Skip to content

Commit

Permalink
Merge pull request #2 from AvantiPoint/icon-bug
Browse files Browse the repository at this point in the history
fix bug with icon download
  • Loading branch information
dansiegel authored Apr 19, 2021
2 parents 4f93a98 + fe30bb8 commit ebf7f15
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace AvantiPoint.Packages.Hosting
/// See: https://docs.microsoft.com/en-us/nuget/api/package-base-address-resource
/// </summary>
[AllowAnonymous]
[AuthorizedNuGetConsumer]
public class PackageContentController : Controller
{
private readonly IPackageContentService _content;
Expand All @@ -27,6 +26,7 @@ public PackageContentController(IPackageContentService content)
_content = content ?? throw new ArgumentNullException(nameof(content));
}

[AuthorizedNuGetConsumer]
public async Task<ActionResult<PackageVersionsResponse>> GetPackageVersionsAsync(string id, CancellationToken cancellationToken)
{
var versions = await _content.GetPackageVersionsOrNullAsync(id, cancellationToken);
Expand All @@ -39,6 +39,7 @@ public async Task<ActionResult<PackageVersionsResponse>> GetPackageVersionsAsync
}

[HandlePackageDownloaded]
[AuthorizedNuGetConsumer]
public async Task<IActionResult> DownloadPackageAsync(string id, string version, [FromServices]IPackageContext packageContext, CancellationToken cancellationToken)
{
if (!NuGetVersion.TryParse(version, out var nugetVersion))
Expand All @@ -52,7 +53,6 @@ public async Task<IActionResult> DownloadPackageAsync(string id, string version,
return NotFound();
}


packageContext.PackageId = id;
packageContext.PackageVersion = version;

Expand All @@ -62,6 +62,7 @@ public async Task<IActionResult> DownloadPackageAsync(string id, string version,
};
}

[AuthorizedNuGetConsumer]
public async Task<IActionResult> DownloadNuspecAsync(string id, string version, CancellationToken cancellationToken)
{
if (!NuGetVersion.TryParse(version, out var nugetVersion))
Expand All @@ -78,7 +79,6 @@ public async Task<IActionResult> DownloadNuspecAsync(string id, string version,
return File(nuspecStream, "text/xml");
}

[AllowAnonymous]
public async Task<IActionResult> DownloadReadmeAsync(string id, string version, CancellationToken cancellationToken)
{
if (!NuGetVersion.TryParse(version, out var nugetVersion))
Expand All @@ -95,7 +95,6 @@ public async Task<IActionResult> DownloadReadmeAsync(string id, string version,
return File(readmeStream, "text/markdown");
}

[AllowAnonymous]
public async Task<IActionResult> DownloadIconAsync(string id, string version, CancellationToken cancellationToken)
{
if (!NuGetVersion.TryParse(version, out var nugetVersion))
Expand Down

0 comments on commit ebf7f15

Please sign in to comment.