From c890454769562e0ec2978e123aaf3d9a43e5ef4f Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Mon, 3 Jul 2023 15:33:28 +0200 Subject: Add direct serving of package content (#25543) Fixes #24723 Direct serving of content aka HTTP redirect is not mentioned in any of the package registry specs but lots of official registries do that so it should be supported by the usual clients. --- routers/api/packages/conda/conda.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'routers/api/packages/conda') diff --git a/routers/api/packages/conda/conda.go b/routers/api/packages/conda/conda.go index f778690630..9c5edd548b 100644 --- a/routers/api/packages/conda/conda.go +++ b/routers/api/packages/conda/conda.go @@ -292,15 +292,11 @@ func DownloadPackageFile(ctx *context.Context) { pf := pfs[0] - s, _, err := packages_service.GetPackageFileStream(ctx, pf) + s, u, _, err := packages_service.GetPackageFileStream(ctx, pf) if err != nil { apiError(ctx, http.StatusInternalServerError, err) return } - defer s.Close() - ctx.ServeContent(s, &context.ServeHeaderOptions{ - Filename: pf.Name, - LastModified: pf.CreatedUnix.AsLocalTime(), - }) + helper.ServePackageFile(ctx, s, u, pf) } -- cgit v1.2.3