Fix weird mime type bug in alpine/magic
This commit is contained in:
+1
-1
@@ -178,7 +178,7 @@ bridge:
|
|||||||
args:
|
args:
|
||||||
width: 256
|
width: 256
|
||||||
height: 256
|
height: 256
|
||||||
background: "ffffff"
|
background: "020202"
|
||||||
|
|
||||||
# Whether to bridge Telegram bot messages as m.notices or m.texts.
|
# Whether to bridge Telegram bot messages as m.notices or m.texts.
|
||||||
bot_messages_as_notices: true
|
bot_messages_as_notices: true
|
||||||
|
|||||||
@@ -202,7 +202,10 @@ async def _unlocked_transfer_file_to_matrix(client: MautrixTelegramClient, inten
|
|||||||
mime_type = magic.from_buffer(file, mime=True)
|
mime_type = magic.from_buffer(file, mime=True)
|
||||||
|
|
||||||
image_converted = False
|
image_converted = False
|
||||||
if mime_type == "application/gzip" and is_sticker and tgs_convert:
|
# A weird bug in alpine/magic makes it return application/octet-stream for gzips...
|
||||||
|
if is_sticker and tgs_convert and (mime_type == "application/gzip" or (
|
||||||
|
mime_type == "application/octet-stream"
|
||||||
|
and magic.from_buffer(file).startswith("gzip"))):
|
||||||
mime_type, file, width, height, thumbnail = await convert_tgs_to(
|
mime_type, file, width, height, thumbnail = await convert_tgs_to(
|
||||||
file, tgs_convert["target"], **tgs_convert["args"])
|
file, tgs_convert["target"], **tgs_convert["args"])
|
||||||
image_converted = mime_type != "application/gzip"
|
image_converted = mime_type != "application/gzip"
|
||||||
|
|||||||
Reference in New Issue
Block a user