diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-09-22 05:56:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-21 21:56:25 +0000 |
commit | a802508f88e546bf18990559e44bf27a09c869ee (patch) | |
tree | 594ee7af435c6abf1ef462215cff5e3a7568d6b3 /routers/api/packages/maven/maven.go | |
parent | 5de41737a5d9337cc5b8416b63b2972366c62102 (diff) | |
download | gitea-a802508f88e546bf18990559e44bf27a09c869ee.tar.gz gitea-a802508f88e546bf18990559e44bf27a09c869ee.zip |
Fix wrong last modify time (#32102)
Diffstat (limited to 'routers/api/packages/maven/maven.go')
-rw-r--r-- | routers/api/packages/maven/maven.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/routers/api/packages/maven/maven.go b/routers/api/packages/maven/maven.go index 07e34da8e2..343705990a 100644 --- a/routers/api/packages/maven/maven.go +++ b/routers/api/packages/maven/maven.go @@ -115,7 +115,9 @@ func serveMavenMetadata(ctx *context.Context, params parameters) { xmlMetadataWithHeader := append([]byte(xml.Header), xmlMetadata...) latest := pds[len(pds)-1] - ctx.Resp.Header().Set("Last-Modified", latest.Version.CreatedUnix.Format(http.TimeFormat)) + // http.TimeFormat required a UTC time, refer to https://pkg.go.dev/net/http#TimeFormat + lastModifed := latest.Version.CreatedUnix.AsTime().UTC().Format(http.TimeFormat) + ctx.Resp.Header().Set("Last-Modified", lastModifed) ext := strings.ToLower(filepath.Ext(params.Filename)) if isChecksumExtension(ext) { |