Allow downloading attachments of draft releases (#31369)

Fix #31362

(cherry picked from commit 42718d32af9d259205bee0fde818ffc0c3a9797f)
This commit is contained in:
Zettat123 2024-06-15 12:20:14 +08:00 committed by Earl Warren
parent ff43d02803
commit 813bf24445
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 0579CB2928A78A00

View file

@ -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)