Skip to content

Commit 9bf6574

Browse files
authored
Merge pull request #163 from ruby-docx/restore-previous-behaviour
Accepts files whose extension is not .docx or which does not have extension
2 parents 944ac4d + 111a83d commit 9bf6574

File tree

2 files changed

+0
-7
lines changed

2 files changed

+0
-7
lines changed

lib/docx/document.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def initialize(path_or_io, options = {})
2929

3030
# if path-or_io is string && does not contain a null byte
3131
if (path_or_io.instance_of?(String) && !/\u0000/.match?(path_or_io))
32-
raise Errno::EIO.new('Invalid file format') if !File.extname(path_or_io).eql?('.docx')
3332
@zip = Zip::File.open(path_or_io)
3433
else
3534
@zip = Zip::File.open_buffer(path_or_io)

spec/docx/document_spec.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@
2020
end
2121

2222
context 'When reading a un-supported file' do
23-
it 'should throw file not supported error' do
24-
expect do
25-
Docx::Document.open(@fixtures_path + '/invalid_format.pdf')
26-
end.to raise_error(Errno::EIO, 'Input/output error - Invalid file format')
27-
end
28-
2923
it 'should throw file not found error' do
3024
invalid_path = @fixtures_path + '/invalid_file_path.docx'
3125
expect do

0 commit comments

Comments
 (0)