mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Use ID or Where to instead directly use Get when load object from database (#11925)
* Use ID or Where to instead directly use Get when load object from database * Apply suggestions from code review Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
		@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user