diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-11-24 15:25:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-24 16:25:13 +0200 |
commit | fc7a2d5a959334f7195571a3e1db669ed7667a28 (patch) | |
tree | e03df232ebc29e508680686c396cfecb4eeb0902 /routers/web | |
parent | 26f941fbdac73844a93c902ce6d1144175ff23ed (diff) | |
download | gitea-fc7a2d5a959334f7195571a3e1db669ed7667a28.tar.gz gitea-fc7a2d5a959334f7195571a3e1db669ed7667a28.zip |
Add support for HEAD requests in Maven registry (#21834)
Related #18543
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'routers/web')
-rw-r--r-- | routers/web/repo/repo.go | 5 | ||||
-rw-r--r-- | routers/web/user/package.go | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/routers/web/repo/repo.go b/routers/web/repo/repo.go index 7bcca1d02a..17e600182d 100644 --- a/routers/web/repo/repo.go +++ b/routers/web/repo/repo.go @@ -426,7 +426,10 @@ func download(ctx *context.Context, archiveName string, archiver *repo_model.Rep } defer fr.Close() - ctx.ServeContent(downloadName, fr, archiver.CreatedUnix.AsLocalTime()) + ctx.ServeContent(fr, &context.ServeHeaderOptions{ + Filename: downloadName, + LastModified: archiver.CreatedUnix.AsLocalTime(), + }) } // InitiateDownload will enqueue an archival request, as needed. It may submit diff --git a/routers/web/user/package.go b/routers/web/user/package.go index 7179e2df97..7be37b6a50 100644 --- a/routers/web/user/package.go +++ b/routers/web/user/package.go @@ -402,5 +402,8 @@ func DownloadPackageFile(ctx *context.Context) { } defer s.Close() - ctx.ServeContent(pf.Name, s, pf.CreatedUnix.AsLocalTime()) + ctx.ServeContent(s, &context.ServeHeaderOptions{ + Filename: pf.Name, + LastModified: pf.CreatedUnix.AsLocalTime(), + }) } |