-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Refactor parse_xml function to handle external target references (Issue #1349) #1350
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
base: master
Are you sure you want to change the base?
Conversation
…T_Relationship class
Hello def getinfo(self, name):
"""Return the instance of ZipInfo given 'name'."""
info = self.NameToInfo.get(name)
if info is None:
> raise KeyError(
'There is no item named %r in the archive' % name)
E KeyError: "There is no item named 'word/#schémaglobal' in the archive" |
Hello |
Hello @al-rahul |
I've made a pull request already, but the repo owner seems to be inactive and hasn't touched it in more than a year. |
+1 I also faced a similar issue and I tried the change of this PR and it works. Please, it would be very useful if the proposed PR could get merged. |
@ondrej-111 if @scanny can't, can you maybe help with this? |
Possible temporary fixes, in your requirements.txt instead of python-docx==1.1.2 or similar, use instead: OPTION A: OPTION B: |
The added code checks if self.target_ref exists and if it starts with a "#", which is a common way to denote external references. If both conditions are met, the method returns RTM.EXTERNAL, indicating that the target reference is external.
This change improves the robustness of our code by correctly handling and classifying external references. This will prevent potential errors or unexpected behavior when encountering such references.