🐛 Fix attachment did not updated

This commit is contained in:
LittleSheep 2024-12-29 00:49:38 +08:00
parent 3eee9755d4
commit b041ce3e06

View File

@ -190,7 +190,7 @@ func TryLinkAttachment(tx *gorm.DB, og models.Attachment, hash string) (bool, er
} }
func UpdateAttachment(item models.Attachment) (models.Attachment, error) { func UpdateAttachment(item models.Attachment) (models.Attachment, error) {
if err := database.C.Model(&item).Updates(&item).Error; err != nil { if err := database.C.Save(&item).Error; err != nil {
return item, err return item, err
} else { } else {
CacheAttachment(item) CacheAttachment(item)