Code

gitweb: allow space as delimiter in mime.types
authorLudwig Nussel <ludwig.nussel@suse.de>
Wed, 15 Jun 2011 06:10:08 +0000 (08:10 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Jun 2011 16:46:07 +0000 (09:46 -0700)
in openSUSE /etc/mime.types has only spaces. I don't know if there's
a canonical reference that says that only tabs are allowed. Mutt at
least also accepts spaces. So make gitweb more liberal too.

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl

index f8db40a1c25a2cdf1c4dc1ff42aba0fe66ef8f1c..fc689f837094a2aff8b9235ce5ec38399ca64ab5 100755 (executable)
@@ -3383,12 +3383,9 @@ sub mimetype_guess_file {
        open(my $mh, '<', $mimemap) or return undef;
        while (<$mh>) {
                next if m/^#/; # skip comments
-               my ($mimetype, $exts) = split(/\t+/);
-               if (defined $exts) {
-                       my @exts = split(/\s+/, $exts);
-                       foreach my $ext (@exts) {
-                               $mimemap{$ext} = $mimetype;
-                       }
+               my ($mimetype, @exts) = split(/\s+/);
+               foreach my $ext (@exts) {
+                       $mimemap{$ext} = $mimetype;
                }
        }
        close($mh);