瀏覽代碼

Fix order of checks for detecting image resolution

Tulir Asokan 2 年之前
父節點
當前提交
5a4ebc74b8
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      mautrix_instagram/portal.py

+ 1 - 1
mautrix_instagram/portal.py

@@ -830,7 +830,7 @@ class Portal(DBPortal, BasePortal):
         if convert_fn is not None:
             data, info.mimetype = await convert_fn(data, info.mimetype)
 
-        if not info.width and not info.height and info.mimetype.startswith("image/"):
+        if info.mimetype.startswith("image/") and not info.width and not info.height:
             with BytesIO(data) as inp, Image.open(inp) as img:
                 info.width, info.height = img.size
         info.size = len(data)