Repository navigation
Skip non-image parts when gathering image parts - #1648
Open
draarivpatel-ui wants to merge 1 commit into
Open
draarivpatel-ui wants to merge 1 commit into
draarivpatel-ui wants to merge 1 commit into
Conversation
An image whose contents cannot be parsed when a package is loaded
(e.g. because of broken EXIF data) is represented by a plain Part
object rather than an ImagePart. Because such parts have no .sha1
member, a later add_picture() call failed with:
AttributeError: 'Part' object has no attribute 'sha1'
Skip relationship targets that are not ImagePart instances when
gathering image parts, mirroring the corresponding fix in python-pptx.
Fixes python-openxml#1565
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1565.
When a package is loaded, an image whose contents cannot be parsed (for example because of broken EXIF data) is represented by a plain
Partobject rather than anImagePart._gather_image_partsstill adds it to the image-part collection, so a lateradd_picture()call fails while looking for duplicate images:Skip relationship targets that are not
ImagePartinstances when gathering the image parts, mirroring the fix for the corresponding python-pptx issue (scanny/python-pptx#382). A package containing such a part can then still be extended with new pictures, and the already present (unparseable) image is left untouched.