mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	refactor(models/attachement): use getAttachmentsByUUIDs (#9317)
This commit is contained in:
		@@ -129,16 +129,9 @@ func UpdateRelease(rel *Release) error {
 | 
			
		||||
// AddReleaseAttachments adds a release attachments
 | 
			
		||||
func AddReleaseAttachments(releaseID int64, attachmentUUIDs []string) (err error) {
 | 
			
		||||
	// Check attachments
 | 
			
		||||
	var attachments = make([]*Attachment, 0)
 | 
			
		||||
	for _, uuid := range attachmentUUIDs {
 | 
			
		||||
		attach, err := getAttachmentByUUID(x, uuid)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			if IsErrAttachmentNotExist(err) {
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
			return fmt.Errorf("getAttachmentByUUID [%s]: %v", uuid, err)
 | 
			
		||||
		}
 | 
			
		||||
		attachments = append(attachments, attach)
 | 
			
		||||
	attachments, err := GetAttachmentsByUUIDs(attachmentUUIDs)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("GetAttachmentsByUUIDs [uuids: %v]: %v", attachmentUUIDs, err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for i := range attachments {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user