1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-15 23:17:19 +00:00

Use ID or Where to instead directly use Get when load object from database (#11925) (#11934)

Backport #11925

Use ID or Where to instead directly use Get when load object from database

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
6543
2020-06-17 21:53:43 +02:00
committed by GitHub
parent 47a5c8e1f7
commit ecad970a26
9 changed files with 25 additions and 28 deletions

View File

@@ -76,8 +76,8 @@ func NewUpload(name string, buf []byte, file multipart.File) (_ *Upload, err err
// GetUploadByUUID returns the Upload by UUID
func GetUploadByUUID(uuid string) (*Upload, error) {
upload := &Upload{UUID: uuid}
has, err := x.Get(upload)
upload := &Upload{}
has, err := x.Where("uuid=?", uuid).Get(upload)
if err != nil {
return nil, err
} else if !has {