List Info

Thread: file upload bug - patch attached




file upload bug - patch attached
user name
2006-11-17 15:01:52
If I submit a form containing both a textfield and a
file-upload
field, which both have the name 'foo' ...

With CGI.pm, $q->param('foo') gives me:
[
  'textfield value',
  *blessed_filename,
]

With Catalyst, $c->req->param('foo') only gives:
'filename'

This is because uploads are processed after other parameters
and
stomps on existing values.
The attached patch fixes it ( includes tests 
It would now return this:
[
  'textfield value',
  'filename',
]

Carl
_______________________________________________
Catalyst-dev mailing list
Catalyst-devlists.rawmode.org
http://lists.rawmode.org/mailman/listinfo/catalyst-dev

file upload bug - patch attached
user name
2006-11-17 16:51:28
Carl Franks wrote:
> The attached patch fixes it ( includes tests 
> It would now return this:
> [
>  'textfield value',
>  'filename',
> ]
> 
> Carl

Thanks, applied as #5522.


-- 
package JAPH;use Catalyst
qw/-Debug/;($;=JAPH)->config(name => do {
$,.=reverse qw[Jonathan tsu rehton lre rekca
Rockway][$_].[split //,
";$;"]->[$_].q; ;for
1..4;$,=~s;^.;;;$,});$;->setup;

_______________________________________________
Catalyst-dev mailing list
Catalyst-devlists.rawmode.org
http://lists.rawmode.org/mailman/listinfo/catalyst-dev

file upload bug - patch attached
user name
2006-11-17 17:53:05
On second thought, is there a reason why we're not blessing
the
'filename'?  How can the app differentiate between a
textfield with the
text 'filename' and an actual file named 'filename'?

Carl Franks wrote:
> If I submit a form containing both a textfield and a
file-upload
> field, which both have the name 'foo' ...
> 
> With CGI.pm, $q->param('foo') gives me:
> [
>  'textfield value',
>  *blessed_filename,
> ]
> 
> With Catalyst, $c->req->param('foo') only gives:
> 'filename'
> 
> This is because uploads are processed after other
parameters and
> stomps on existing values.
> The attached patch fixes it ( includes tests 
> It would now return this:
> [
>  'textfield value',
>  'filename',
> ]
> 
> Carl

-- 
package JAPH;use Catalyst
qw/-Debug/;($;=JAPH)->config(name => do {
$,.=reverse qw[Jonathan tsu rehton lre rekca
Rockway][$_].[split //,
";$;"]->[$_].q; ;for
1..4;$,=~s;^.;;;$,});$;->setup;

_______________________________________________
Catalyst-dev mailing list
Catalyst-devlists.rawmode.org
http://lists.rawmode.org/mailman/listinfo/catalyst-dev

file upload bug - patch attached
user name
2006-11-17 18:24:25
* Jonathan Rockway <jonjrock.us> [2006-11-17
18:55]:
> On second thought, is there a reason why we're not
blessing the
> 'filename'?  How can the app differentiate between a
textfield
> with the text 'filename' and an actual file named
'filename'?

CGI.pm blesses the value in order to enable a lazy (and
dangerous) idiom; I don’t see any need to emulate that. If
the
form elements both have the same name, it would seems the
app
doesn’t need/want to distinguish them, anyway.

The Catalyst way of getting at the upload info is much like
the
sane API in CGI.pm: you use `$c->req->upload('foo')`
rather than
`$c->req->param('foo')`.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/&g
t;

_______________________________________________
Catalyst-dev mailing list
Catalyst-devlists.rawmode.org
http://lists.rawmode.org/mailman/listinfo/catalyst-dev

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )