Changeset 336


Ignore:
Timestamp:
01/24/11 00:38:58 (13 years ago)
Author:
nanardon
Message:
  • use Mime::Type to not index binary files
File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/trunk/web/lib/Sophie/Scan/RpmParser/Sources.pm

    r333 r336  
    1010use Encode::Guess; 
    1111use Encode; 
     12use MIME::Types; 
    1213 
    1314sub run { 
     
    3738                return 1; 
    3839            } 
    39             $fname =~ /\.(gz|zip|bz2|xz|lzma)$/ and return 1; 
     40 
     41            if (my $plaintext = MIME::Types->new->mimeTypeOf($fname)) { 
     42                $plaintext->isBinary and return 1; 
     43            } 
     44             
    4045            my $rawcontent = $file->get_content; 
    4146            my $content; 
Note: See TracChangeset for help on using the changeset viewer.