From 08572fe8d0ad97c01ecc5c0f0ee39e610de383a3 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 1 Apr 2014 11:59:26 +0100 Subject: Work around a bug in unrtf --- lib/attachment_to_html/adapters/rtf.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib/attachment_to_html') diff --git a/lib/attachment_to_html/adapters/rtf.rb b/lib/attachment_to_html/adapters/rtf.rb index 24987a975..871ca2c60 100644 --- a/lib/attachment_to_html/adapters/rtf.rb +++ b/lib/attachment_to_html/adapters/rtf.rb @@ -96,8 +96,19 @@ module AttachmentToHTML cleanup_tempfile(tempfile) - html + sanitize_converted(html) end + + end + + # Works around http://savannah.gnu.org/bugs/?42015 in unrtf ~> 0.21 + def sanitize_converted(html) + invalid = %Q() + valid = %Q(") + if html.include?(invalid) + html.sub!(invalid, valid) + end + html end def create_tempfile(text) -- cgit v1.2.3