Fix allow-unsafe-ext compat option (#16920)

Fix bug in e578e265f7

Closes #16919
Authored by: bashonly
This commit is contained in:
bashonly
2026-06-10 23:00:05 +00:00
committed by GitHub
parent a541df1ea5
commit e47691215f
3 changed files with 18 additions and 1 deletions
+5
View File
@@ -5218,12 +5218,17 @@ class _UnsafeExtensionError(Exception):
'sbv',
])
_enabled = True
def __init__(self, extension, /):
super().__init__(f'unsafe file extension: {extension!r}')
self.extension = extension
@classmethod
def sanitize_extension(cls, extension, /, *, prepend=False, _allowed_exts=()):
if not cls._enabled:
return extension
if extension is None:
return None