Changed delimiter to \n

This commit is contained in:
Andrew Murray 2022-05-22 14:11:11 +10:00
parent 44c6467400
commit 62d5817e29
2 changed files with 7 additions and 6 deletions

View File

@ -813,10 +813,10 @@ def test_zero_comment_subblocks():
assert_image_equal_tofile(im, TEST_GIF)
def test_read_multiple_comments():
def test_read_multiple_comment_blocks():
with Image.open("Tests/images/multiple_comments.gif") as im:
# Multiple comments in a frame are separated not concatenated
assert im.info["comment"] == b"Test comment 1\r\nTest comment 2"
# Multiple comment blocks in a frame are separated not concatenated
assert im.info["comment"] == b"Test comment 1\nTest comment 2"
def test_version(tmp_path):

View File

@ -228,15 +228,16 @@ class GifImageFile(ImageFile.ImageFile):
#
# comment extension
#
# Collect one comment block
comment = b""
# Collect one comment block
while block:
comment += block
block = self.data()
# If multiple comments in frame, separate in info with \r\n
if "comment" in info:
info["comment"] += b"\r\n" + comment
# If multiple comment blocks in frame, separate with \n
info["comment"] += b"\n" + comment
else:
info["comment"] = comment
s = None