[Rt-commit] rt branch, 4.4/fix-rest-1-mime-encoding-in-ticket-create, created. rt-4.4.4-131-g7c57aa072b

? sunnavy sunnavy at bestpractical.com
Wed Aug 12 13:37:03 EDT 2020


The branch, 4.4/fix-rest-1-mime-encoding-in-ticket-create has been created
        at  7c57aa072b1d0f1c591da5bdea5cac0320d458fe (commit)

- Log -----------------------------------------------------------------
commit 7c57aa072b1d0f1c591da5bdea5cac0320d458fe
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Aug 13 00:40:01 2020 +0800

    Force update MIME encoding for ticket creation via REST 1.0
    
    We generally don't need the encoding conversion as the fields are
    already UTF-8. But SetMIMEEntityToUTF8 also massages something else,
    like removing double quotes, etc. which we need here.
    
    Note that the method is already called in other places, so it's good to
    call it here too for consistency.
    
    This is initially to fix the double-quotes issue of attachment names,
    e.g.
    
        curl 'http://localhost/REST/1.0/ticket/new?user=root&pass=password' \
        --form 'content=Queue: General
        Requestor: root at localhost
        Subject: Some subject
        Status: new
        Attachment: "some, file.txt"
        Text: Required text field: req' --form 'attachment_1=@/tmp/test.txt'
    
    We need to quote the filename here because it contains comma, otherwise
    RT would assume it to attach 2 files, "some" and "file.txt".
    
    Without this commit, the name saved in RT would be "some, file.txt"
    including quotes.

diff --git a/share/html/REST/1.0/Forms/ticket/default b/share/html/REST/1.0/Forms/ticket/default
index b87e7cd5fe..0780267dbf 100644
--- a/share/html/REST/1.0/Forms/ticket/default
+++ b/share/html/REST/1.0/Forms/ticket/default
@@ -219,6 +219,7 @@ else {
                 goto DONE;
             }
             $v{MIMEObj}->make_singlepart;
+            RT::I18N::SetMIMEEntityToUTF8( $v{MIMEObj} );
         }
 
         my($tid,$trid,$terr) = $ticket->Create(%v);    

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


More information about the rt-commit mailing list