We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0fee931 commit 3a3c850Copy full SHA for 3a3c850
lib/docx/document.rb
@@ -25,6 +25,7 @@ def initialize(path_or_io, options = {})
25
26
# if path-or_io is string && does not contain a null byte
27
if (path_or_io.instance_of?(String) && !/\u0000/.match?(path_or_io))
28
+ raise Errno::EIO.new('invalid file format') if !File.extname(path_or_io).eql?('.docx')
29
@zip = Zip::File.open(path_or_io)
30
else
31
@zip = Zip::File.open_buffer(path_or_io)
@@ -37,8 +38,6 @@ def initialize(path_or_io, options = {})
37
38
@doc = Nokogiri::XML(@document_xml)
39
load_styles
40
yield(self) if block_given?
- rescue Zip::Error => e
41
- raise 'File not supported'
42
ensure
43
@zip.close unless @zip.nil?
44
end
0 commit comments