]> source.dussan.org Git - gitea.git/commitdiff
Allow downloading attachments of draft releases (#31369) (#31380)
authorGiteabot <teabot@gitea.io>
Sun, 16 Jun 2024 12:55:14 +0000 (20:55 +0800)
committerGitHub <noreply@github.com>
Sun, 16 Jun 2024 12:55:14 +0000 (20:55 +0800)
Backport #31369 by Zettat123

Fix #31362

Co-authored-by: Zettat123 <zettat123@gmail.com>
routers/web/repo/repo.go

index f54b35c3e0b36dfd8fab8654805613bfe98a952e..c1eda8b674760f41a14a0f466ecf156ee1158dbd 100644 (file)
@@ -418,8 +418,9 @@ func RedirectDownload(ctx *context.Context) {
        tagNames := []string{vTag}
        curRepo := ctx.Repo.Repository
        releases, err := db.Find[repo_model.Release](ctx, repo_model.FindReleasesOptions{
-               RepoID:   curRepo.ID,
-               TagNames: tagNames,
+               IncludeDrafts: ctx.Repo.CanWrite(unit.TypeReleases),
+               RepoID:        curRepo.ID,
+               TagNames:      tagNames,
        })
        if err != nil {
                ctx.ServerError("RedirectDownload", err)