Repository navigation
Always use GIF89a for comments - #6292
Conversation
Fix bug that allows GIFs with long comments to be written as GIF87a.
| if info and extensionKey in info: | ||
| if (extensionKey == "duration" and info[extensionKey] == 0) or ( | ||
| extensionKey == "comment" and not (1 <= len(info[extensionKey]) <= 255) | ||
| extensionKey == "comment" and len(info[extensionKey]) == 0 |
There was a problem hiding this comment.
| extensionKey == "comment" and len(info[extensionKey]) == 0 | |
| extensionKey == "comment" and info[extensionKey] |
This seems simpler to me?
There was a problem hiding this comment.
@radarhere, thank you for reviewing my PR.
The test needs to determine that info[comment] is an empty string to keep version as 87a. Your suggestion info[extensionKey] does the opposite. I was attempting to extrapolate from not (1 <= len(info[extensionKey]) <= 255) (which originated with PR #1896 but was superseded by PR #3479) to retain the length test. I think it probably could be info[extensionKey] == "" or even not info[extensionKey]. The 255 was there to begin with, I think, to fit with the maximum length of the single data block that was allowed before PR #3479.
There was a problem hiding this comment.
You're right - I meant not info[extensionKey]. That was just a mistake on my part.
|
This forces GIF89a for all comments, not just "long comments". So wouldn't it be more straightforward to modify |
Pillow already uses GIF89a for shorter comments, so adding |
|
Ok, thanks. That's perfectly fair. |
|
I've created https://github.com/raygard/Pillow/pull/1 with a suggestion from me, to add the check to |
Simplified version check
Fix bug that allows GIFs with long comments to be written as GIF87a.
Fixes #6291 .
Changes proposed in this pull request:
_get_global_header()to use GIF89a for long comments.test_comment_over_255()to check this.