Closed bmulholland closed 3 years ago
I created this fix https://github.com/ruby-docx/docx/pull/104
@bmulholland the new version, v0.6.1 of docx gem has been released. it contains a bug fix (thank you, @WaKeMaTTa !) to fix this issue. please try it!
Amazing - thanks for the fast turnaround! I just got time to try it out, and the immediate issue is indeed solved. However, now we get a different error with the same file, just when we try to get the document's text.
I don't have time right now to dig in more, but can if needed.
Source:
Docx::Document.open(file) do |doc|
return doc.to_s
end
Trace:
NoMethodError:
undefined method `xpath' for nil:NilClass
# /Users/bmulholland/.rvm/gems/ruby-2.7.2@recital-backend/gems/docx-0.6.1/lib/docx/document.rb:94:in `hyperlink_relationships'
# /Users/bmulholland/.rvm/gems/ruby-2.7.2@recital-backend/gems/docx-0.6.1/lib/docx/document.rb:88:in `hyperlinks'
# /Users/bmulholland/.rvm/gems/ruby-2.7.2@recital-backend/gems/docx-0.6.1/lib/docx/document.rb:48:in `document_properties'
# /Users/bmulholland/.rvm/gems/ruby-2.7.2@recital-backend/gems/docx-0.6.1/lib/docx/document.rb:189:in `parse_paragraph_from'
# /Users/bmulholland/.rvm/gems/ruby-2.7.2@recital-backend/gems/docx-0.6.1/lib/docx/document.rb:61:in `block in paragraphs'
# /Users/bmulholland/.rvm/gems/ruby-2.7.2@recital-backend/gems/nokogiri-1.11.3-x86_64-darwin/lib/nokogiri/xml/node_set.rb:239:in `block in each'
# /Users/bmulholland/.rvm/gems/ruby-2.7.2@recital-backend/gems/nokogiri-1.11.3-x86_64-darwin/lib/nokogiri/xml/node_set.rb:238:in `upto'
# /Users/bmulholland/.rvm/gems/ruby-2.7.2@recital-backend/gems/nokogiri-1.11.3-x86_64-darwin/lib/nokogiri/xml/node_set.rb:238:in `each'
# /Users/bmulholland/.rvm/gems/ruby-2.7.2@recital-backend/gems/docx-0.6.1/lib/docx/document.rb:61:in `map'
# /Users/bmulholland/.rvm/gems/ruby-2.7.2@recital-backend/gems/docx-0.6.1/lib/docx/document.rb:61:in `paragraphs'
# /Users/bmulholland/.rvm/gems/ruby-2.7.2@recital-backend/gems/docx-0.6.1/lib/docx/document.rb:110:in `to_s'
This weekend I will spend sometime improving lib/docx/document.rb
following the DOCX structure.
Should I open a new issue for the crash I posted above?
This weekend I will spend sometime improving
lib/docx/document.rb
following the DOCX structure.
Sorry @bmulholland , I had a couple busy weeks. I didn't start this :top: .
Should I open a new issue for the crash I posted above?
Yeah, you should.
Nothing to apologize for - this project is free and I appreciate any work you do put in :). I ask just to make sure it doesn't fall off the radar.
Describe the bug
I found a .docx file that appears to be completely valid (it opens in Word) but raises an error ENOENT when opening with this gem.
To Reproduce
Docx::Document.new with this file: weird_docx.docx
The code looks for word/document.xml and word/document2.xml but not word/document22.xml, which is what's inside this doc.
Isn't Word just obnoxious?