Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 8de0fac

Browse files
author
David Robertson
authored
Fix mypy against latest pillow stubs (#12671)
1 parent 41a882e commit 8de0fac

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

changelog.d/12671.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix mypy against latest pillow stubs.

poetry.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

synapse/rest/media/v1/thumbnailer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ def _resize(self, width: int, height: int) -> Image.Image:
121121
#
122122
# If the image has transparency, use RGBA instead.
123123
if self.image.mode in ["1", "L", "P"]:
124-
mode = "RGB"
125124
if self.image.info.get("transparency", None) is not None:
126-
mode = "RGBA"
127-
self.image = self.image.convert(mode)
125+
self.image = self.image.convert("RGBA")
126+
else:
127+
self.image = self.image.convert("RGB")
128128
return self.image.resize((width, height), Image.ANTIALIAS)
129129

130130
def scale(self, width: int, height: int, output_type: str) -> BytesIO:

0 commit comments

Comments
 (0)