Skip to content
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

Malformed <Relationship> Node When Merging Documents (affects merging documents with images) #10

Open
aw3as opened this issue Aug 14, 2020 · 0 comments · May be fixed by #11
Open

Malformed <Relationship> Node When Merging Documents (affects merging documents with images) #10

aw3as opened this issue Aug 14, 2020 · 0 comments · May be fixed by #11

Comments

@aw3as
Copy link

aw3as commented Aug 14, 2020

In def self.merge_documents, when attaching a new Relationship node (new_rel_node = "<Relationship Id=#{new_id} Type=#{node["Type"]} Target=#{target_val} />"), Nokogiri will attempt to fix the XML and in the process lowercase all of the attributes, resulting in a corrupt word/_rels/document.xml.rels (e.g. <relationship id="rId101" type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" target="media/image101.png"/>).

Proposed solution would be to either properly escape new_rel_node, e.g. new_rel_node = "<Relationship Id=\"#{new_id}\" Type=\"#{node["Type"]}\" Target=\"#{target_val}\" />", or to use Nokogiri::XML::Node.new to properly create the node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant