Skip to content

Commit

Permalink
fix bug with icon download
Browse files Browse the repository at this point in the history
closes #1
  • Loading branch information
dansiegel committed Apr 18, 2021
1 parent 4f93a98 commit fe30bb8
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 fe30bb8

Please sign in to comment.