From eabf0fdea1b90f666c2da119065547d4a6f8f72c Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 16 Sep 2024 20:22:30 +0800 Subject: [PATCH] :bug: Fix lookup sticker via alias didn't preload attachment --- pkg/internal/services/stickers.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/internal/services/stickers.go b/pkg/internal/services/stickers.go index a88dddf..4722fc5 100644 --- a/pkg/internal/services/stickers.go +++ b/pkg/internal/services/stickers.go @@ -13,7 +13,8 @@ func GetStickerWithAlias(alias string) (models.Sticker, error) { prefix := viper.GetString("database.prefix") if err := database.C. Joins(fmt.Sprintf("LEFT JOIN %ssticker_packs pk ON pack_id = pk.id", prefix)). - Where("CONCAT(pk.prefix, alias) = ?", alias).First(&sticker).Error; err != nil { + Where("CONCAT(pk.prefix, alias) = ?", alias). + Preload("Attachment").First(&sticker).Error; err != nil { return sticker, err } return sticker, nil