ruby-docx / docx

a ruby library/gem for interacting with .docx files
MIT License
431 stars 170 forks source link

When a file other than docx is provided, an unexpected error is thrown. #136

Closed manovasanth1227 closed 1 year ago

manovasanth1227 commented 1 year ago

Describe the bug

When a file other than docx is provided, an unexpected error is thrown.

To Reproduce

Steps to reproduce the behavior or put a short code to reproduce the bug.

example

require 'docx'

doc = Docx::Document.new('/local/usr/path/reciept.pdf')
## error thrown
<Zip::Error: Zip end of central directory signature not found>

Expected behavior

Should throw valid error message

Environment

manovasanth1227 commented 1 year ago

I have also fixed the issue and raised the PR - https://github.com/ruby-docx/docx/pull/135 @satoryu can you please review?