Allow comments in FITS images

This commit is contained in:
Andrew Murray 2023-02-25 16:44:07 +11:00
parent 879e77a446
commit 8a1b9aa0ad
2 changed files with 7 additions and 1 deletions

View File

@ -44,6 +44,12 @@ def test_naxis_zero():
pass
def test_comment():
image_data = b"SIMPLE = T / comment string"
with pytest.raises(OSError):
FitsImagePlugin.FitsImageFile(BytesIO(image_data))
def test_stub_deprecated():
class Handler:
opened = False

View File

@ -32,7 +32,7 @@ class FitsImageFile(ImageFile.ImageFile):
keyword = header[:8].strip()
if keyword == b"END":
break
value = header[8:].strip()
value = header[8:].split(b"/")[0].strip()
if value.startswith(b"="):
value = value[1:].strip()
if not headers and (not _accept(keyword) or value != b"T"):