[Rt-commit] rt branch, 4.0/error-handling-for-quote-extraction, created. rt-4.0.11-90-g75d7f3a

Thomas Sibley trs at bestpractical.com
Mon Apr 29 17:17:31 EDT 2013


The branch, 4.0/error-handling-for-quote-extraction has been created
        at  75d7f3a267e2a92751b63e11e4119405815479fc (commit)

- Log -----------------------------------------------------------------
commit 75d7f3a267e2a92751b63e11e4119405815479fc
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Mon Apr 29 14:16:11 2013 -0700

    Error handling for text and HTML quote extraction when displaying attachments
    
    Improves the error message by adding the attachment ID and directs bug
    reports to rt-bugs at bestpractical.com.

diff --git a/share/html/Ticket/Elements/ShowTransactionAttachments b/share/html/Ticket/Elements/ShowTransactionAttachments
index 9ff6d10..f70f279 100644
--- a/share/html/Ticket/Elements/ShowTransactionAttachments
+++ b/share/html/Ticket/Elements/ShowTransactionAttachments
@@ -216,8 +216,17 @@ my $render_attachment = sub {
                     ticket  => $Ticket,
                 );
 
-                require HTML::Quoted;
-                $content = HTML::Quoted->extract($content) unless length $name;
+                unless (length $name) {
+                    eval {
+                        require HTML::Quoted;
+                        $content = HTML::Quoted->extract($content)
+                    };
+                    if ($@) {
+                        RT->Logger->error(
+                            "HTML::Quoted couldn't process attachment #@{[$message->id]}: $@."
+                          . "  This is a bug, please report it to rt-bugs\@bestpractical.com.");
+                    }
+                }
 
                 $m->comp(
                     'ShowMessageStanza',
@@ -235,8 +244,15 @@ my $render_attachment = sub {
             # It's a text type we don't have special handling for
             else {
                 unless ( length $name ) {
-                    eval { require Text::Quoted;  $content = Text::Quoted::extract($content); };
-                    if ($@) { $RT::Logger->warning( "Text::Quoted failed: $@" ) }
+                    eval {
+                        require Text::Quoted;
+                        $content = Text::Quoted::extract($content);
+                    };
+                    if ($@) {
+                        RT->Logger->error(
+                            "Text::Quoted couldn't process attachment #@{[$message->id]}: $@."
+                          . "  This is a bug, please report it to rt-bugs\@bestpractical.com.");
+                    }
                 }
 
                 $m->comp(

-----------------------------------------------------------------------


More information about the Rt-commit mailing list