Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

upload: Replace deprecated PIL.PngImagePlugin.APNG_DISPOSE_OP_NONE.

Anders Kaseorgf90a41bab06d
diff --git a/zerver/lib/upload/base.py b/zerver/lib/upload/base.py
index 80cc7ff5354..3eb07e230c2 100644
--- a/zerver/lib/upload/base.py
+++ b/zerver/lib/upload/base.py
@@ -111,7 +111,12 @@ def resize_animated(im: Image.Image, size: int = DEFAULT_EMOJI_SIZE) -> bytes:
im.disposal_method # type: ignore[attr-defined] # private member missing from stubs
)
elif isinstance(im, PngImagePlugin.PngImageFile):
- disposals.append(im.info.get("disposal", PngImagePlugin.APNG_DISPOSE_OP_NONE))
+ disposals.append(
+ im.info.get(
+ "disposal",
+ PngImagePlugin.Disposal.OP_NONE, # type: ignore[attr-defined] # https://github.com/python/typeshed/pull/9698
+ )
+ )
else: # nocoverage
raise BadImageError(_("Unknown animated image format."))
out = io.BytesIO()