Skip to content

Commit

Permalink
check filename first
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 31, 2013
1 parent 52253ce commit 5cf6108
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/Mojo/Message.pm
Expand Up @@ -273,11 +273,10 @@ sub _parse_formdata {
next;
}

# Extract information from Content-Disposition header
next unless my $disposition = $part->headers->content_disposition;
my ($name) = $disposition =~ /[; ]name="?([^";]+)"?/;
my ($filename) = $disposition =~ /[; ]filename="?([^"]*)"?/;
next if ($upload && !defined $filename) || (!$upload && defined $filename);
my ($name) = $disposition =~ /[; ]name="?([^";]+)"?/;
if ($charset) {
$name = decode($charset, $name) // $name if $name;
$filename = decode($charset, $filename) // $filename if $filename;
Expand Down

0 comments on commit 5cf6108

Please sign in to comment.