mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Move attachment into models/repo/ (#17650)
* Move attachment into models/repo/ * Fix test * Fix bug
This commit is contained in:
parent
7a03473159
commit
fc3d082609
39 changed files with 477 additions and 414 deletions
|
@ -14,6 +14,7 @@ import (
|
|||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/db"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/models/unit"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
|
@ -346,7 +347,7 @@ func RedirectDownload(ctx *context.Context) {
|
|||
curRepo := ctx.Repo.Repository
|
||||
releases, err := models.GetReleasesByRepoIDAndNames(db.DefaultContext, curRepo.ID, tagNames)
|
||||
if err != nil {
|
||||
if models.IsErrAttachmentNotExist(err) {
|
||||
if repo_model.IsErrAttachmentNotExist(err) {
|
||||
ctx.Error(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
@ -355,7 +356,7 @@ func RedirectDownload(ctx *context.Context) {
|
|||
}
|
||||
if len(releases) == 1 {
|
||||
release := releases[0]
|
||||
att, err := models.GetAttachmentByReleaseIDFileName(release.ID, fileName)
|
||||
att, err := repo_model.GetAttachmentByReleaseIDFileName(release.ID, fileName)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusNotFound)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue