If plugin has already been imported and registered the extension, return early

Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
This commit is contained in:
Hugo van Kemenade 2026-01-19 11:28:42 +02:00 committed by GitHub
parent 7f38f980dd
commit 096c479cfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -406,6 +406,9 @@ def _load_plugin_for_extension(ext: str | bytes) -> bool:
"""Load only the plugin needed for a specific file extension."""
if isinstance(ext, bytes):
ext = ext.decode()
if ext in EXTENSION:
return True
plugin = _EXTENSION_PLUGIN.get(ext.lower())
if plugin is None:
return False