Skip to content

Commit

Permalink
should always write content types file
Browse files Browse the repository at this point in the history
  • Loading branch information
fran-worley committed Oct 3, 2016
1 parent 65142a4 commit a12c1e4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/htmltoword/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ def generate
elsif @replaceable_files[entry.name]
out.write(@replaceable_files[entry.name])
elsif entry.name == Document.content_types_xml_file
out.write(inject_image_content_types(entry.get_input_stream.read)) if @image_files.size > 0
raw_file = entry.get_input_stream.read
content_types = @image_files.empty? ? raw_file : inject_image_content_types(raw_file)

out.write(content_types)
else
out.write(template_zip.read(entry.name))
end
end
if @image_files.size > 0
unless @image_files.empty?
#stream the image files into the media folder using open-uri
@image_files.each do |hash|
out.put_next_entry("word/media/#{hash[:filename]}")
Expand Down

0 comments on commit a12c1e4

Please sign in to comment.