aboutsummaryrefslogtreecommitdiffstats
path: root/lib/attachment_to_html/adapters/rtf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/attachment_to_html/adapters/rtf.rb')
-rw-r--r--lib/attachment_to_html/adapters/rtf.rb13
1 files changed, 12 insertions, 1 deletions
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(<!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN>)
+ valid = %Q(<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN>")
+ if html.include?(invalid)
+ html.sub!(invalid, valid)
+ end
+ html
end
def create_tempfile(text)