✨ Change update attachment policy to prevent conflict with analyzer
This commit is contained in:
parent
36c814e1dc
commit
8196aac3de
@ -142,7 +142,6 @@ func updateAttachmentMeta(c *fiber.Ctx) error {
|
||||
var data struct {
|
||||
Alternative string `json:"alt"`
|
||||
Usage string `json:"usage"`
|
||||
Metadata map[string]any `json:"metadata"`
|
||||
IsMature bool `json:"is_mature"`
|
||||
}
|
||||
|
||||
@ -157,7 +156,6 @@ func updateAttachmentMeta(c *fiber.Ctx) error {
|
||||
|
||||
attachment.Alternative = data.Alternative
|
||||
attachment.Usage = data.Usage
|
||||
attachment.Metadata = data.Metadata
|
||||
attachment.IsMature = data.IsMature
|
||||
|
||||
if attachment, err := services.UpdateAttachment(attachment); err != nil {
|
||||
|
@ -113,7 +113,7 @@ func TryLinkAttachment(tx *gorm.DB, og models.Attachment, hash string) (bool, er
|
||||
}
|
||||
|
||||
func UpdateAttachment(item models.Attachment) (models.Attachment, error) {
|
||||
if err := database.C.Save(&item).Error; err != nil {
|
||||
if err := database.C.Updates(&item).Error; err != nil {
|
||||
return item, err
|
||||
} else {
|
||||
MaintainAttachmentCache()
|
||||
|
Loading…
Reference in New Issue
Block a user