Skip to content

Commit

Permalink
fix: can't download files
Browse files Browse the repository at this point in the history
  • Loading branch information
Misaka-L committed Aug 30, 2024
1 parent c554a5b commit bae214b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VPMReposSynchronizer.Core/Services/RepoBrowserService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private VpmPackage GetPackageWithUrl(VpmPackageEntity package)
var vpmPackage = mapper.Map<VpmPackage>(package);

var fileDownloadEndpoint = new Uri(fileHostOptions.Value.BaseUrl,
$"files/{package.FileId}/download/{package.PackageId}.zip").ToString();
$"files/download/{package.PackageId}.zip").ToString();
vpmPackage.Url = QueryHelpers.AddQueryString(fileDownloadEndpoint, "fileId", package.FileId);

return vpmPackage;
Expand Down
9 changes: 6 additions & 3 deletions VPMReposSynchronizer.Entry/Controllers/FileController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public class FileController(IFileHostService fileHostService) : ControllerBase
/// <response code="404">Request file doesn't exist</response>
/// <response code="429">Send too many request in a time</response>
/// <response code="403">You have been banned</response>
[Route("{fileId}/download/{fileName}")]
[Route("{fileId}/download")]
// ReSharper disable once RouteTemplates.RouteParameterIsNotPassedToMethod
#pragma warning disable ASP0018
[Route("download/{fileName}")]
#pragma warning restore ASP0018
[Route("download")]
[HttpGet]
[ProducesResponseType(StatusCodes.Status302Found)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
Expand All @@ -34,4 +37,4 @@ public async Task<IActionResult> DownloadFile(string fileId)

return Redirect(fileUri);
}
}
}

0 comments on commit bae214b

Please sign in to comment.