Ticket #476: mimetype2.patch

File mimetype2.patch, 657 bytes (added by karl.forner, 5 years ago)

new patch

  • Padre/lib/Padre/Wx/Main.pm

     
    43124312 
    43134313    if ( $editor->insert_from_file($file) ) { 
    43144314        my $document = $editor->{Document}; 
    4315         $document->set_mimetype( Padre::MimeTypes->mime_type_by_extension($extension) ); 
     4315        my $mime_type = Padre::MimeTypes->mime_type_by_extension($extension); 
     4316        $mime_type = $mime_type->() if ref($mime_type) eq 'CODE'; # call sub if needed 
     4317        $document->set_mimetype( $mime_type ); 
    43164318        $document->editor->padre_setup; 
    43174319        $document->rebless; 
    43184320    } else {