[Rt-commit] rt branch, 4.0/rest-attachment-compilation-error, created. rt-4.0.11-69-g0cfd622

Thomas Sibley trs at bestpractical.com
Tue Apr 23 15:52:30 EDT 2013


The branch, 4.0/rest-attachment-compilation-error has been created
        at  0cfd6223b87c9e6b1997482f2a0b78b2d9304f90 (commit)

- Log -----------------------------------------------------------------
commit adc47505d64b8afcf4127b7a03dacba9b42f7b8b
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Apr 23 12:48:30 2013 -0700

    REST: A typo caused a compilation error in the /REST/1.0/attachment/NN endpoint
    
    Uncaught since 411c37f when it was originally contributed via a patch in 2008.

diff --git a/share/html/REST/1.0/Forms/attachment/default b/share/html/REST/1.0/Forms/attachment/default
index d9df7fc..8c68040 100644
--- a/share/html/REST/1.0/Forms/attachment/default
+++ b/share/html/REST/1.0/Forms/attachment/default
@@ -67,7 +67,7 @@ unless ( $attachment->Id eq $id ) {
 my @arglist = split( '/', $args || "" );
 my $content;
 
-if ( @argslist and $arglist[0] eq 'content' ) {
+if ( @arglist and $arglist[0] eq 'content' ) {
     $c = $attachment->OriginalContent;
 } else {
     my @data;

commit 0cfd6223b87c9e6b1997482f2a0b78b2d9304f90
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Apr 23 12:49:59 2013 -0700

    REST: Send a proper MIME type when returning a non-text attachment
    
    Mimics the behaviour of /REST/1.0/ticket/X/attachments/Y/content, of
    which /REST/1.0/attachment/NN/content is mostly a copy.

diff --git a/share/html/REST/1.0/Forms/attachment/default b/share/html/REST/1.0/Forms/attachment/default
index 8c68040..80039ce 100644
--- a/share/html/REST/1.0/Forms/attachment/default
+++ b/share/html/REST/1.0/Forms/attachment/default
@@ -69,6 +69,8 @@ my $content;
 
 if ( @arglist and $arglist[0] eq 'content' ) {
     $c = $attachment->OriginalContent;
+    $r->content_type($attachment->ContentType)
+        if $attachment->ContentType !~ /^text\//;
 } else {
     my @data;
     push @data, [ id              => "attachment/" . $attachment->Id ];

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


More information about the Rt-commit mailing list