-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix zipfile.py 'UserWarning: Duplicate name: docProps/core.xml' #1436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix zipfile.py 'UserWarning: Duplicate name: docProps/core.xml' #1436
Conversation
src/docx/opc/package.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First see below how to create a setter. Then change this line to
self.rels[rel].reltype = RT.CORE_PROPERTIES
src/docx/opc/rel.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a setter
@reltype.setter def reltype(self, value: str): self._reltype = value
rafguns
commented
May 21, 2025
Hi @cip91sk , anything I can do to help this PR along? I would add the requested changes myself but I can't (at least not in this PR) since I'm not a maintainer.
cip91sk
commented
May 24, 2025
Sorry for the delay, I missed the previous messages.
I corrected with a proper setter, let me know if it's all good now!
Some documents in _rels/.rels, for the relation the targets "docProps/core.xml", have the relationship type
http://schemas.openxmlformats.org/officedocument/2006/relationships/metadata/core-propertiesinstead of
http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-propertiesIn these cases, python-docx doesn't see that the core-properties are already set, it creates new ones and append a duplicate docProps/core.xml file in the zip