[Rt-commit] rt branch, 4.4/fix-rest-1-filename-encoding, created. rt-4.4.4-131-gb15a6cf52c

? sunnavy sunnavy at bestpractical.com
Mon Aug 10 17:17:06 EDT 2020


The branch, 4.4/fix-rest-1-filename-encoding has been created
        at  b15a6cf52c9eda8dfee1abf6de070eb7b70741b5 (commit)

- Log -----------------------------------------------------------------
commit b15a6cf52c9eda8dfee1abf6de070eb7b70741b5
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Aug 11 04:59:30 2020 +0800

    Encode attachment filename to UTF-8 like other fields in REST 1.0
    
    This is to get rid of the following errors when filenames with wide
    characters(like Chinese) are passed:
    
        Wide character at /opt/rt4/sbin/../lib/RT/Util.pm line 130.
    
    This is consistent with the approach we handle other fields like
    From, Subject, etc.

diff --git a/lib/RT/Interface/REST.pm b/lib/RT/Interface/REST.pm
index 2cd707c478..16280a8b61 100644
--- a/lib/RT/Interface/REST.pm
+++ b/lib/RT/Interface/REST.pm
@@ -367,7 +367,7 @@ sub process_attachments {
         my $new_entity = $entity->attach(
             Path => $tmp_fn,
             Type => $info->{'Content-Type'} || guess_media_type($tmp_fn),
-            Filename => $file,
+            Filename => Encode::encode('UTF-8', $file),
             Disposition => $info->{'Content-Disposition'} || "attachment",
             'Content-ID' => $info->{'Content-ID'},
         );

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


More information about the rt-commit mailing list