From 813bf24445e2388fc9346e4c0e065a5ee7ce48ea Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Sat, 15 Jun 2024 12:20:14 +0800 Subject: [PATCH] Allow downloading attachments of draft releases (#31369) Fix #31362 (cherry picked from commit 42718d32af9d259205bee0fde818ffc0c3a9797f) --- routers/web/repo/repo.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/routers/web/repo/repo.go b/routers/web/repo/repo.go index fa3f0e86de..119a97f28c 100644 --- a/routers/web/repo/repo.go +++ b/routers/web/repo/repo.go @@ -415,8 +415,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)