karnov / htmltoword

Ruby html to word gem
MIT License
177 stars 70 forks source link

OpenURI::HTTPError for broken image link #84

Open sserghei opened 4 years ago

sserghei commented 4 years ago

If you have image with bad url - it fails with OpenURI::HTTPError (502 Bad Gateway):

For me solution is to wrap in begin-rescue block method generate this part of code:

begin
  open(hash[:url], 'rb') do |f|
    out.write(f.read)
  end
rescue
end

file path:lib/htmltoword/document.rb

Could we add it somehow into main branch?