media/sticker: fix lottie mime type

It's always gunzipped, so should never send the application/x-tgsticker mime.
Also, video/lottie+json was recently registered with IANA, so use that instead
of the old image/lottie+json: <https://www.iana.org/assignments/media-types/video/lottie+json>
This commit is contained in:
Tulir Asokan
2025-04-24 15:55:35 +03:00
parent 75964a00ed
commit 48d91fdf76
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -116,7 +116,7 @@ var fileCaps = event.FileFeatureMap{
MimeTypes: map[string]event.CapabilitySupportLevel{
"image/webp": event.CapLevelFullySupported,
// TODO
//"image/lottie+json": event.CapLevelFullySupported,
//"video/lottie+json": event.CapLevelFullySupported,
//"video/webm": event.CapLevelFullySupported,
},
},
+4 -4
View File
@@ -54,17 +54,17 @@ type ConvertedSticker struct {
func (c AnimatedStickerConfig) convert(ctx context.Context, data []byte) ConvertedSticker {
input := bytes.NewBuffer(data)
if c.Target == "disable" {
return ConvertedSticker{DataWriter: input, MIMEType: "application/x-tgsticker"}
return ConvertedSticker{DataWriter: input, MIMEType: "video/lottie+json"}
}
log := zerolog.Ctx(ctx).With().Str("animated_sticker_target", c.Target).Logger()
if !lottie.Supported() {
log.Warn().Msg("lottie not supported, cannot convert animated stickers")
return ConvertedSticker{DataWriter: input, MIMEType: "application/x-tgsticker"}
return ConvertedSticker{DataWriter: input, MIMEType: "video/lottie+json"}
} else if (c.Target == "webp" || c.Target == "webm") && !ffmpeg.Supported() {
log.Warn().Msg("ffmpeg not supported, cannot convert animated stickers")
return ConvertedSticker{DataWriter: input, MIMEType: "application/x-tgsticker"}
return ConvertedSticker{DataWriter: input, MIMEType: "video/lottie+json"}
}
dataWriter := new(bytes.Buffer)
@@ -102,7 +102,7 @@ func (c AnimatedStickerConfig) convert(ctx context.Context, data []byte) Convert
Msg("failed to convert animated sticker to target format")
// Fallback to original data
return ConvertedSticker{DataWriter: input, MIMEType: "application/x-tgsticker"}
return ConvertedSticker{DataWriter: input, MIMEType: "video/lottie+json"}
}
return ConvertedSticker{