🐛 Fix metadata attr type transform issue

This commit is contained in:
LittleSheep 2024-08-03 21:29:22 +08:00
parent 7452b0754d
commit 1a8c28d2f9

View File

@ -77,9 +77,9 @@ func createSticker(c *fiber.Ctx) error {
if strings.SplitN(attachment.MimeType, "/", 2)[0] != "image" {
return fiber.NewError(fiber.StatusBadRequest, "sticker attachment must be an image")
} else if width, ok := attachment.Metadata["width"].(float64); !ok {
} else if width, ok := attachment.Metadata["width"].(int64); !ok {
return fiber.NewError(fiber.StatusBadRequest, "sticker attachment must has width metadata")
} else if height, ok := attachment.Metadata["height"].(float64); !ok {
} else if height, ok := attachment.Metadata["height"].(int64); !ok {
return fiber.NewError(fiber.StatusBadRequest, "sticker attachment must has height metadata")
} else if width != 28 || height != 28 {
return fiber.NewError(fiber.StatusBadRequest, "sticker attachment must be a 28x28 image")