Skip Menu |

This queue is for tickets about the RT-Client-REST CPAN distribution.

Report information
The Basics
Id: 88919
Status: resolved
Priority: 0/
Queue: RT-Client-REST

People
Owner: Nobody in particular
Requestors: bkolera [...] iseek.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.45



Subject: RT::Client::REST 0.44 broken for uploading attachment
Date: Mon, 23 Sep 2013 23:55:29 +0000
To: "bug-RT-Client-REST [...] rt.cpan.org" <bug-RT-Client-REST [...] rt.cpan.org>
From: Ben Kolera <bkolera [...] iseek.com.au>
I'm having an issue where attachments aren't working in version 0.44. I'm just getting an error (from RT) that says "No attachment for run.sh". This brand new line from 0.44: https://metacpan.org/source/DAMS/RT-Client-REST-0.44/lib/RT/Client/REST.pm# L521 Seems to be stringifying the array used to give the arrayref/attachment to HTTP::Common::Request's POST method. As seen here: -------- [bkolera@bkolera6.devvm:~]$socat <mailto:bkolera@bkolera6.devvm.iseek.com.au>devvm:~]$socat> STDIO TCP-LISTEN:2000,reuseaddr POST //REST/1.0/ticket/1006360/comment HTTP/1.1 TE: deflate,gzip;q=0.3 Connection: TE, close Host: bkolera6.devvm:2000 User-Agent: RT::Client::REST/0.44 Content-Length: 239 Content-Type: multipart/form-data; boundary=xYzZY --xYzZY Content-Disposition: form-data; name="attachment_1" Attachment=ARRAY(0xa12faf0) --xYzZY Content-Disposition: form-data; name="content" Ticket: 1006360 Action: comment Text: Attachment test. Attachment: run.sh --xYzZY-- -------- 0.43 Which doesn't have that line and does not exhibit the problem. Is the fix as simple as skipping attachments in that map and letting HTTP::Common::Request take take of the encoding? If so, I can create a patch if you'd like. Kind Regards, Ben Kolera
This patch fixes the issue for me (against 0.44) diff --git a/lib/RT/Client/REST.pm b/lib/RT/Client/REST.pm index 6215dea..8ebef0f 100644 --- a/lib/RT/Client/REST.pm +++ b/lib/RT/Client/REST.pm @@ -518,7 +518,7 @@ sub _submit { # Now, we construct the request. if (@$data) { # The request object expects "bytes", not strings - map { utf8::encode($_) } @$data; + map { utf8::encode($_) unless ref($_)} @$data; $req = POST($self->_uri($uri), $data, Content_Type => 'form-data'); }
On Thu Nov 07 04:57:23 2013, MELMOTHX wrote: Show quoted text
> This patch fixes the issue for me (against 0.44) > > diff --git a/lib/RT/Client/REST.pm b/lib/RT/Client/REST.pm > index 6215dea..8ebef0f 100644 > --- a/lib/RT/Client/REST.pm > +++ b/lib/RT/Client/REST.pm > @@ -518,7 +518,7 @@ sub _submit { > # Now, we construct the request. > if (@$data) { > # The request object expects "bytes", not strings > - map { utf8::encode($_) } @$data; > + map { utf8::encode($_) unless ref($_)} @$data; > > $req = POST($self->_uri($uri), $data, Content_Type => 'form-data'); > }
This change is in 0.45 -- thanks, Marco! Marking FIXED.