Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
cip91sk wants to merge3 commits intopython-openxml:master
base:master
Choose a base branch
Loading
fromcip91sk:fix_duplicate_docprops_corexml

Conversation

cip91sk
Copy link

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-properties
instead of
http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties

In 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

arkanoid87 reacted with thumbs up emoji
try:
office_document_part = self.part_related_by(RT.CORE_PROPERTIES_OFFICEDOCUMENT)
rel = self.relate_to(office_document_part, RT.CORE_PROPERTIES_OFFICEDOCUMENT)
self.rels[rel].set_reltype(RT.CORE_PROPERTIES)

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 asetter. Then change this line to

self.rels[rel].reltype=RT.CORE_PROPERTIES

Comment on lines 137 to 138
def set_reltype(self, reltype:str) -> None:
self._reltype = reltype

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This should be asetter

@reltype.setterdefreltype(self,value:str):self._reltype=value

@rafguns
Copy link

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
Copy link
Author

Sorry for the delay, I missed the previous messages.

I corrected with a proper setter, let me know if it's all good now!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@keestuxkeestuxkeestux left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@cip91sk@rafguns@keestux

[8]ページ先頭

©2009-2025 Movatter.jp