Fix thumbnail API error when QML gives float sizes
This commit is contained in:
parent
93a4015369
commit
e45f2c9d2d
1
TODO.md
1
TODO.md
|
@ -1,6 +1,7 @@
|
||||||
- Media
|
- Media
|
||||||
- SVG uploads
|
- SVG uploads
|
||||||
- Uploading progress bar (+local echo)
|
- Uploading progress bar (+local echo)
|
||||||
|
- Text bubbles theming
|
||||||
- Directly create cache files for our uploads before actually uploading
|
- Directly create cache files for our uploads before actually uploading
|
||||||
- Downloading
|
- Downloading
|
||||||
- Bottom/top bar
|
- Bottom/top bar
|
||||||
|
|
|
@ -194,6 +194,7 @@ class Thumbnail(Media):
|
||||||
)
|
)
|
||||||
|
|
||||||
if isinstance(resp, (nio.DownloadError, nio.ThumbnailError)):
|
if isinstance(resp, (nio.DownloadError, nio.ThumbnailError)):
|
||||||
|
import remote_pdb; remote_pdb.RemotePdb("127.0.0.1", 4444).set_trace()
|
||||||
raise DownloadFailed(resp.message, resp.status_code)
|
raise DownloadFailed(resp.message, resp.status_code)
|
||||||
|
|
||||||
decrypted = await self._decrypt(resp.body)
|
decrypted = await self._decrypt(resp.body)
|
||||||
|
@ -227,5 +228,8 @@ class MediaCache:
|
||||||
self, mxc: str, width: int, height: int, crypt_dict: CryptDict = None,
|
self, mxc: str, width: int, height: int, crypt_dict: CryptDict = None,
|
||||||
) -> str:
|
) -> str:
|
||||||
|
|
||||||
thumb = Thumbnail(self, mxc, None, crypt_dict, (width, height))
|
thumb = Thumbnail(
|
||||||
|
# QML sometimes pass float sizes, which matrix API doesn't like.
|
||||||
|
self, mxc, None, crypt_dict, (round(width), round(height)),
|
||||||
|
)
|
||||||
return str(await thumb.get())
|
return str(await thumb.get())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user