Changeset 339


Ignore:
Timestamp:
01/24/11 11:01:39 (13 years ago)
Author:
nanardon
Message:
  • use File::Magic to discover binary files
File:
1 edited

Legend:

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

    r336 r339  
    1010use Encode::Guess; 
    1111use Encode; 
    12 use MIME::Types; 
     12use File::MMagic; 
    1313 
    1414sub run { 
     
    3939            } 
    4040 
    41             if (my $plaintext = MIME::Types->new->mimeTypeOf($fname)) { 
    42                 $plaintext->isBinary and return 1; 
    43             } 
    44              
    4541            my $rawcontent = $file->get_content; 
     42 
     43            my $mm = new File::MMagic; 
     44            $mm->checktype_contents($rawcontent) =~ /^application\// and return 1; 
     45 
    4646            my $content; 
    4747            foreach my $line (split("\n", $rawcontent)) { 
Note: See TracChangeset for help on using the changeset viewer.