Upload thumbnails with the correct extension

This commit is contained in:
miruka 2020-03-09 10:10:21 -04:00
parent 2307d5f1b2
commit 382235875c
2 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,7 @@
## Before release ## Before release
- Downloaded media filenames
- "exception during sync" aren't caught - "exception during sync" aren't caught
- nio ClientTimeout - nio ClientTimeout
- Name - Name

View File

@ -446,7 +446,8 @@ class MatrixClient(nio.AsyncClient):
except OSError as err: except OSError as err:
log.warning(f"Failed thumbnailing {path}: {err}") log.warning(f"Failed thumbnailing {path}: {err}")
else: else:
thumb_name = f"{path.stem}_thumbnail{''.join(path.suffixes)}" thumb_ext = "png" if thumb_info.mime == "image/png" else "jpg"
thumb_name = f"{path.stem}_thumbnail.{thumb_ext}"
upload_item.status = UploadStatus.Uploading upload_item.status = UploadStatus.Uploading
upload_item.filepath = Path(thumb_name) upload_item.filepath = Path(thumb_name)