You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by Sam Ruby <ru...@apache.org> on 2015/12/13 16:14:52 UTC
[whimsy.git] [11/37] Commit 1cc2c3a: recover from bad HTML
Commit 1cc2c3a463c7b42d592dc8cf0686889ec7ac534c:
recover from bad HTML
Branch: refs/heads/secmail
Author: Sam Ruby <ru...@intertwingly.net>
Committer: Sam Ruby <ru...@intertwingly.net>
Pusher: rubys <ru...@apache.org>
------------------------------------------------------------
views/body.html.rb | +++++++++ --
------------------------------------------------------------
11 changes: 9 additions, 2 deletions.
------------------------------------------------------------
diff --git a/views/body.html.rb b/views/body.html.rb
index 968c484..c79d45b 100644
--- a/views/body.html.rb
+++ b/views/body.html.rb
@@ -37,11 +37,18 @@
#
# Try various ways to display the body
#
+ success = false
if @message.html_part and @message.html_part.body.to_s.valid_encoding?
_div do
- _{@message.html_part.body.to_s.untaint}
+ begin
+ _{@message.html_part.body.to_s.untaint}
+ success = true
+ rescue
+ end
end
- elsif @message.text_part.body
+ end
+
+ if not success and @message.text_part.body
begin
_pre @message.text_part.body.to_s.encode('utf-8')
rescue