Fix thumbnail API error when QML gives float sizes

This commit is contained in:
miruka 2019-11-06 06:51:55 -04:00
parent 93a4015369
commit e45f2c9d2d
2 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,7 @@
- Media
- SVG uploads
- Uploading progress bar (+local echo)
- Text bubbles theming
- Directly create cache files for our uploads before actually uploading
- Downloading
- Bottom/top bar

View File

@ -194,6 +194,7 @@ class Thumbnail(Media):
)
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)
decrypted = await self._decrypt(resp.body)
@ -227,5 +228,8 @@ class MediaCache:
self, mxc: str, width: int, height: int, crypt_dict: CryptDict = None,
) -> 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())