Skip to content

ENOENT error because internal doc is word/document22.xml #103

Description

@bmulholland

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?

Activity

  1. WaKeMaTTa commented on May 4, 2021

    @WaKeMaTTa
    Contributor

    I created this fix #104

  2. satoryu commented on May 5, 2021

    @satoryu
    Member

    @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!

  3. bmulholland commented on May 7, 2021

    @bmulholland
    Author

    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'
    
  4. WaKeMaTTa commented on May 7, 2021

    @WaKeMaTTa
    Contributor

    This weekend I will spend sometime improving lib/docx/document.rb following the DOCX structure.

  5. bmulholland commented on May 19, 2021

    @bmulholland
    Author

    Should I open a new issue for the crash I posted above?

  6. WaKeMaTTa commented on May 19, 2021

    @WaKeMaTTa
    Contributor

    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 🔝 .


    Should I open a new issue for the crash I posted above?

    Yeah, you should.

  7. bmulholland commented on May 19, 2021

    @bmulholland
    Author

    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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions