Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#883 Get_Extension fails for uppercase extension

7.0
open
nobody
5
2012-10-11
2011-12-14
Tim Colson
No

I've got some urls with uppercase extensions (JPG PNG) that weren't being filtered out in the NotPageList... after some digging, I found that it's because Get_Extension was returning "Unknown" because the lookup in $MimeHashLib{$1} is case sensitive. I wrapped $1 with lc() and it works correctly now. :-)

Example URL: /download/attachments/22726386/mail_template_auto.JPG

sub Get_Extension{
my $extension;
my $regext = shift;
my $urlwithnoquery = shift;
if ( $urlwithnoquery =~ /$regext/o
|| ( $urlwithnoquery =~ /[\\/]$/ && $DefaultFile[0] =~ /$regext/o )
)
{
## Tim added lc() around the mimHashlib key to accommodate JPG and PNG
$extension =
( $LevelForFileTypesDetection >= 2 || $MimeHashLib{lc($1)} )
? lc($1)
: 'Unknown';
}
else {
$extension = 'Unknown';
}
return $extension;
}

Discussion

  • Tim Colson
    Tim Colson
    2011-12-14

    FYI - I downloaded 7.1 and I’m using that -- but it's still reporting itself as being 7.0.