puzzle / prawn-markup

Parse simple HTML markup to include in Prawn PDFs
MIT License
65 stars 16 forks source link

SocketError when parsing HTML that contains a non-existant URL #22

Closed JanekNaymspace closed 2 years ago

JanekNaymspace commented 2 years ago

Suppose you got this code:

pdf = Prawn::Document.new
pdf.markup('<p>some text</p><img src="https://dlawjdklwajdwakl.djwakldj"><p>some other text</p>')

It fails with SocketError (Failed to open TCP connection to dlawjdklwajdwakl.djwakldj:443 (getaddrinfo: Name or service not known)). Of course this exception is correct because the URL does not exist, but is there a possibility to ignore this non-existant URL?

This exception is not caught by https://github.com/puzzle/prawn-markup/blob/master/lib/prawn/markup/processor/images.rb#L75

codez commented 2 years ago

Thank you for the notification!