mirror of
https://github.com/go-gitea/gitea.git
synced 2026-11-02 13:44:16 +09:00
Backport #39855 by @basavaraj-sm05 Legacy (v1 to v3) artifact uploads stored the request's `Content-Encoding` header in the column that v4 artifacts read as their `Content-Type`. - Store only the `gzip` marker on legacy uploads, the only encoding their clients send - Pick the PDF and audio/video serve headers only for content types that `mime.ParseMediaType` accepts Co-authored-by: Basavaraj S m <basavaraj@digiscrypt.com> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
4 files changed
+14
-8
No files matched your search
@@ -281,7 +281,7 @@ func (ar artifactRoutes) uploadArtifact(ctx *ArtifactContext) {
|
||||
artifact.FileCompressedSize != chunksTotalSize {
|
||||
artifact.FileSize = fileRealTotalSize
|
||||
artifact.FileCompressedSize = chunksTotalSize
|
||||
artifact.ContentEncodingOrType = ctx.Req.Header.Get("Content-Encoding")
|
||||
artifact.ContentEncodingOrType = util.Iif(ctx.Req.Header.Get("Content-Encoding") == actions.ContentEncodingV3Gzip, actions.ContentEncodingV3Gzip, "") // other values could be served as a v4 Content-Type
|
||||
if err := actions.UpdateArtifact(ctx, artifact, "file_size", "file_compressed_size", "content_encoding"); err != nil {
|
||||
log.Error("Error update artifact: %v", err)
|
||||
ctx.HTTPError(http.StatusInternalServerError, "Error update artifact")
|
||||
|
||||
Reference in new issue
Block a user