From c03618551492c55e98425254496112a3bee501b1 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 24 Jan 2026 22:48:41 +0200 Subject: [PATCH] Ensure lower before checking if ext in EXTENSION Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com> --- src/PIL/Image.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 9ed251496..743632e1f 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -406,10 +406,11 @@ def _import_plugin_for_extension(ext: str | bytes) -> bool: """Import only the plugin needed for a specific file extension.""" if isinstance(ext, bytes): ext = ext.decode() + ext = ext.lower() if ext in EXTENSION: return True - plugin = _EXTENSION_PLUGIN.get(ext.lower()) + plugin = _EXTENSION_PLUGIN.get(ext) if plugin is None: return False