[Rt-commit] rt branch, 4.0/att-filename-fix, created. rt-4.0.0rc6-139-gaad5666

? sunnavy sunnavy at bestpractical.com
Mon Mar 21 09:34:33 EDT 2011


The branch, 4.0/att-filename-fix has been created
        at  aad5666ae8f9241628050a2f194f6410ec8cf95d (commit)

- Log -----------------------------------------------------------------
commit 7b2622b2642a887fd3d1d3f6c60de265f659012e
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Mar 21 16:10:55 2011 +0800

    recommended_filename may return strings containing \x.. data

diff --git a/lib/RT/Attachment.pm b/lib/RT/Attachment.pm
index 7fc9aba..31d48bd 100644
--- a/lib/RT/Attachment.pm
+++ b/lib/RT/Attachment.pm
@@ -140,7 +140,12 @@ sub Create {
     #Get the filename
     my $Filename = $Attachment->head->recommended_filename;
     # remove path part. 
-    $Filename =~ s!.*/!! if $Filename;
+    if ($Filename) {
+        $Filename =~ s!.*/!!;
+        if ( $Filename =~ s/\\x(\w{2})/chr hex $1/ige ) {
+            utf8::decode($Filename);
+        }
+    }
 
     # MIME::Head doesn't support perl strings well and can return
     # octets which later will be double encoded in low-level code

commit aad5666ae8f9241628050a2f194f6410ec8cf95d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Mar 21 16:12:03 2011 +0800

    test download link text

diff --git a/t/web/attachment_encoding.t b/t/web/attachment_encoding.t
index 2fe8200..5506bbd 100644
--- a/t/web/attachment_encoding.t
+++ b/t/web/attachment_encoding.t
@@ -82,7 +82,7 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE};
 
     $m->back;
     $m->back;
-    $m->follow_link_ok( { text_regex => qr/by Enoch Root/ },
+    $m->follow_link_ok( { text => 'Download 附件.txt' },
         '-> /Ticket/Attachment/...' );
     $m->content_contains( '附件', 'has content 附件' );
 

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


More information about the Rt-commit mailing list