Replace slice and comparison with startswith

This commit is contained in:
Andrew Murray 2025-05-07 14:59:34 +10:00 committed by GitHub
parent 661c0d8a35
commit ade1db0835
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,8 +25,8 @@ except ImportError:
def _accept(prefix: bytes) -> bool:
is_jxl = (
prefix[:2] == b"\xff\x0a"
or prefix[:12] == b"\x00\x00\x00\x0c\x4a\x58\x4c\x20\x0d\x0a\x87\x0a"
prefix.startswith(b"\xff\x0a")
or prefix.startswith(b"\x00\x00\x00\x0c\x4a\x58\x4c\x20\x0d\x0a\x87\x0a")
)
if is_jxl and not SUPPORTED:
msg = "image file could not be identified because JXL support not installed"