Skip Menu |

This queue is for tickets about the Catalyst-Runtime CPAN distribution.

Report information
The Basics
Id: 22540
Status: resolved
Priority: 0/
Queue: Catalyst-Runtime

People
Owner: Nobody in particular
Requestors: jonasbn [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 5.7001
Fixed in: (no value)



Subject: Config and Catalyst::Request::Upload
The POD indicates it is possible to set a temporary directory for use with Catalyst::Request::Upload in Catalyst::Request::Upload. This does however not seem to work. jonasbn
On Tue Oct 24 08:23:03 2006, JONASBN wrote: Show quoted text
> The POD indicates it is possible to set a temporary directory for use with > Catalyst::Request::Upload in Catalyst::Request::Upload.
Can you provide us with a failing test case?
Subject: Re: [rt.cpan.org #22540] Config and Catalyst::Request::Upload
Date: Tue, 17 Jun 2008 21:50:56 +0200
To: bug-Catalyst-Runtime [...] rt.cpan.org
From: Jonas Brømsø Nielsen <jonasbn [...] gmail.com>
Hello Brian, No I am sorry, I am no longer working on the project - and I have moved on. Thanks, jonasbn On 26/05/2008, at 15.03, Brian Cassidy via RT wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=22540 > > > On Tue Oct 24 08:23:03 2006, JONASBN wrote:
>> The POD indicates it is possible to set a temporary directory for >> use with >> Catalyst::Request::Upload in Catalyst::Request::Upload.
> > Can you provide us with a failing test case? >
Attached is an updated test that, i think, proves the failure.
=== t/live_engine_request_uploads.t ================================================================== --- t/live_engine_request_uploads.t (revision 34689) +++ t/live_engine_request_uploads.t (local) @@ -6,7 +6,7 @@ use FindBin; use lib "$FindBin::Bin/lib"; -use Test::More tests => 75; +use Test::More tests => 88; use Catalyst::Test 'TestApp'; use Catalyst::Request; @@ -242,3 +242,62 @@ is( $upload->filename, 'catalyst_130pix.gif' ); } } + +# test uploadtmp config var + +{ + my $creq; + + my $dir = "$FindBin::Bin/"; + local TestApp->config->{ uploadtmp } = $dir; + + my $request = POST( + 'http://localhost/dump/request/', + 'Content-Type' => 'multipart/form-data', + 'Content' => [ + 'testfile' => ["$FindBin::Bin/live_engine_request_uploads.t"], + ] + ); + + ok( my $response = request($request), 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + like( + $response->content, + qr/^bless\( .* 'Catalyst::Request' \)$/s, + 'Content is a serialized Catalyst::Request' + ); + + { + no strict 'refs'; + ok( + eval '$creq = ' . $response->content, + 'Unserialize Catalyst::Request' + ); + } + + isa_ok( $creq, 'Catalyst::Request' ); + is( $creq->method, 'POST', 'Catalyst::Request method' ); + is( $creq->content_type, 'multipart/form-data', + 'Catalyst::Request Content-Type' ); + is( $creq->content_length, $request->content_length, + 'Catalyst::Request Content-Length' ); + + for my $part ( $request->parts ) { + + my $disposition = $part->header('Content-Disposition'); + my %parameters = @{ ( split_header_words($disposition) )[0] }; + + next unless exists $parameters{filename}; + + my $upload = $creq->{uploads}->{ $parameters{name} }; + + isa_ok( $upload, 'Catalyst::Request::Upload' ); + + is( $upload->type, $part->content_type, 'Upload Content-Type' ); + is( $upload->size, length( $part->content ), 'Upload Content-Length' ); + + like( $upload->tempname, qr{\Q$dir\E}, 'uploadtmp' ); + } +} +
Fixed in svn revision 7995 (requires HTTP::Body 1.04).