Skip to content
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
8901741
Feature non zipped actions artifacts
ChristopherHX Feb 28, 2026
accc370
Merge branch 'main' into non-zip-artifacts
ChristopherHX Feb 28, 2026
36b0c0e
fix typo
ChristopherHX Feb 28, 2026
1fd4fbe
.
ChristopherHX Feb 28, 2026
4b1fa71
.
ChristopherHX Feb 28, 2026
ff5d1bb
revert b64chunkName encoding, seams like I caused the initial issue i…
ChristopherHX Feb 28, 2026
c6540ef
add Content-Security-Policy
ChristopherHX Feb 28, 2026
035aa22
Revert "add Content-Security-Policy"
ChristopherHX Feb 28, 2026
33a2b68
Update routers/web/repo/actions/view.go
ChristopherHX Feb 28, 2026
2980ea9
update comment
ChristopherHX Feb 28, 2026
fef0ca4
implement TODO
ChristopherHX Mar 1, 2026
076ee4f
add more upload tests without content-length header
ChristopherHX Mar 1, 2026
b70c185
assert mime type in db
ChristopherHX Mar 1, 2026
e2c19cf
lint
ChristopherHX Mar 1, 2026
f032a5a
fix comment
ChristopherHX Mar 1, 2026
cf03c2a
add Content-Security-Policy + inline back
ChristopherHX Mar 1, 2026
7a33ad9
fix minio
ChristopherHX Mar 1, 2026
c773028
Set content headers for internal download
ChristopherHX Mar 1, 2026
fe9a14d
test blob storage content type
ChristopherHX Mar 1, 2026
ceb933e
fixes
ChristopherHX Mar 1, 2026
b8b3d67
Merge reqParams before returning
ChristopherHX Mar 1, 2026
3c3d45d
.
ChristopherHX Mar 1, 2026
07fbdbc
...
ChristopherHX Mar 1, 2026
cfb3e7e
fix test
ChristopherHX Mar 1, 2026
754c601
fixes
ChristopherHX Mar 1, 2026
2bae491
Merge branch 'main' into non-zip-artifacts
ChristopherHX Mar 5, 2026
57e7dce
Merge branch 'main' of https://github.com/go-gitea/gitea into non-zip…
ChristopherHX Mar 7, 2026
c302794
cleanup
ChristopherHX Mar 7, 2026
fbf28e8
fix
ChristopherHX Mar 7, 2026
10a7cae
cleanup
ChristopherHX Mar 7, 2026
1ea4611
Remove hacks
ChristopherHX Mar 7, 2026
893a0be
revert
ChristopherHX Mar 7, 2026
ff31359
add missing code for webui content-type serve direct
ChristopherHX Mar 7, 2026
68f5ee9
...
ChristopherHX Mar 7, 2026
702fa9a
Merge branch 'main' of https://github.com/go-gitea/gitea into non-zip…
ChristopherHX Mar 9, 2026
8c3590b
refactor
ChristopherHX Mar 9, 2026
744bb71
Reenable ServeDirect for minio
ChristopherHX Mar 9, 2026
2994294
update comments
ChristopherHX Mar 9, 2026
deae805
fix double import
ChristopherHX Mar 9, 2026
6666dff
close body
ChristopherHX Mar 9, 2026
dcbe0d6
cleanup
ChristopherHX Mar 9, 2026
8ba37a2
GetArtifactV4ServeDirectURL add method param
ChristopherHX Mar 10, 2026
9c2528e
application/pdf skip Content-Security-Policy
ChristopherHX Mar 10, 2026
89af55d
Only use inline for web route
ChristopherHX Mar 10, 2026
b6a1ba6
add download tests other file types internal api
ChristopherHX Mar 10, 2026
d1ac1db
Fix old test
ChristopherHX Mar 11, 2026
83c6dc5
Merge branch 'main' of https://github.com/go-gitea/gitea into non-zip…
ChristopherHX Mar 22, 2026
8fd3a9a
refac
ChristopherHX Mar 22, 2026
51280b0
fixes
ChristopherHX Mar 22, 2026
60b39df
refactor content disposition formatting
ChristopherHX Mar 22, 2026
6772530
add copyright
ChristopherHX Mar 22, 2026
1282340
apply feedback
ChristopherHX Mar 22, 2026
95cfb1e
fix
ChristopherHX Mar 22, 2026
fc05027
feedback
ChristopherHX Mar 22, 2026
e1fb863
add more tests for ContentDisposition
ChristopherHX Mar 22, 2026
5dd8e5e
revert content-type
ChristopherHX Mar 24, 2026
6dc705a
move from public to httplib
ChristopherHX Mar 24, 2026
e9bc1ca
Unify artifact storage path
ChristopherHX Mar 24, 2026
70cc32a
Split finalizeArtifact finalizer
ChristopherHX Mar 24, 2026
8399396
Merge branch 'main' of https://github.com/go-gitea/gitea into non-zip…
ChristopherHX Mar 24, 2026
5331f99
fix lint
ChristopherHX Mar 24, 2026
a4aad65
clarify ContentEncoding
wxiaoguang Mar 25, 2026
809822c
clarify ContentEncoding
wxiaoguang Mar 25, 2026
3606c73
fix defer
wxiaoguang Mar 25, 2026
d7006b8
clean serve file opts
wxiaoguang Mar 25, 2026
071ae49
* artifact rest api also use base64.RawURLEncoding to avoid possible …
ChristopherHX Mar 25, 2026
068a324
add comment
wxiaoguang Mar 25, 2026
c544734
fix comments and tests
wxiaoguang Mar 25, 2026
57a7679
fix db column name
wxiaoguang Mar 25, 2026
efd98a2
clean up
wxiaoguang Mar 25, 2026
7364517
clean up
wxiaoguang Mar 25, 2026
88a7abb
fix tests
wxiaoguang Mar 25, 2026
6c40a56
fix fmt
wxiaoguang Mar 25, 2026
4fc90b0
fix test
wxiaoguang Mar 25, 2026
50737ec
fix test
wxiaoguang Mar 25, 2026
dc0f605
simplify code
wxiaoguang Mar 25, 2026
51371c3
fix content type detection
wxiaoguang Mar 25, 2026
7b9922a
fix content serving
wxiaoguang Mar 25, 2026
6eef0e4
fix DownloadArtifactV4ReadStorage
wxiaoguang Mar 25, 2026
8081b79
fix incorrect httplib.ServeXxx
wxiaoguang Mar 25, 2026
3c3c78a
revert tests
wxiaoguang Mar 25, 2026
b00f5ec
rename internal function
wxiaoguang Mar 25, 2026
d5a62f2
fix default ContentDisposition
wxiaoguang Mar 25, 2026
83231b5
clarify content-type charset detection
wxiaoguang Mar 25, 2026
7d80929
Merge branch 'main' into non-zip-artifacts
wxiaoguang Mar 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion models/actions/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (opts FindArtifactsOptions) ToConds() builder.Cond {
}
if opts.FinalizedArtifactsV4 {
cond = cond.And(builder.Eq{"status": ArtifactStatusUploadConfirmed}.Or(builder.Eq{"status": ArtifactStatusExpired}))
cond = cond.And(builder.Eq{"content_encoding": "application/zip"})
cond = cond.And(builder.Like{"content_encoding", "/"})
}

return cond
Expand Down
13 changes: 10 additions & 3 deletions modules/actions/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
package actions

import (
"fmt"
"net/http"
"net/url"
"strings"

actions_model "code.gitea.io/gitea/models/actions"
"code.gitea.io/gitea/modules/setting"
Expand All @@ -13,13 +16,16 @@ import (
)

// Artifacts using the v4 backend are stored as a single combined zip file per artifact on the backend
// The v4 backend ensures ContentEncoding is set to "application/zip", which is not the case for the old backend
// The v4 backend ensures ContentEncoding contains a slash (otherwise this uses application/zip instead of the custom mime type), which is not the case for the old backend
func IsArtifactV4(art *actions_model.ActionArtifact) bool {
return art.ArtifactName+".zip" == art.ArtifactPath && art.ContentEncoding == "application/zip"
return strings.Contains(art.ContentEncoding, "/")
}

func DownloadArtifactV4ServeDirectOnly(ctx *context.Base, art *actions_model.ActionArtifact) (bool, error) {
if setting.Actions.ArtifactStorage.ServeDirect() {
reqParams := url.Values{}
reqParams.Set("response-content-type", art.ContentEncoding)
reqParams.Set("response-content-disposition", fmt.Sprintf("inline; filename=%s; filename*=UTF-8''%s", url.PathEscape(art.ArtifactPath), art.ArtifactPath))
u, err := storage.ActionsArtifacts.URL(art.StoragePath, art.ArtifactPath, ctx.Req.Method, nil)
if u != nil && err == nil {
ctx.Redirect(u.String(), http.StatusFound)
Expand All @@ -35,7 +41,8 @@ func DownloadArtifactV4Fallback(ctx *context.Base, art *actions_model.ActionArti
return err
}
defer f.Close()
http.ServeContent(ctx.Resp, ctx.Req, art.ArtifactName+".zip", art.CreatedUnix.AsLocalTime(), f)
ctx.Resp.Header().Set("Content-Type", art.ContentEncoding)
http.ServeContent(ctx.Resp, ctx.Req, art.ArtifactPath, art.CreatedUnix.AsLocalTime(), f)
return nil
}

Expand Down
Loading
Loading