git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: allow space as delimiter in mime.types
@ 2011-06-14 14:09 Ludwig Nussel
  2011-06-14 14:59 ` Jakub Narebski
  0 siblings, 1 reply; 5+ messages in thread
From: Ludwig Nussel @ 2011-06-14 14:09 UTC (permalink / raw)
  To: git; +Cc: Ludwig Nussel

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.
---
 gitweb/gitweb.perl |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1b83a8d..d81d87b 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3560,12 +3560,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);
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] gitweb: allow space as delimiter in mime.types
  2011-06-14 14:09 [PATCH] gitweb: allow space as delimiter in mime.types Ludwig Nussel
@ 2011-06-14 14:59 ` Jakub Narebski
  2011-06-14 19:30   ` J.H.
  2011-06-14 21:28   ` Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: Jakub Narebski @ 2011-06-14 14:59 UTC (permalink / raw)
  To: Ludwig Nussel; +Cc: git

Ludwig Nussel <ludwig.nussel@suse.de> writes:

> Subject: [PATCH] gitweb: allow space as delimiter in mime.types

A very minor nitpick: perhaps "work with" rather than "allow" would be
better?

> 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.

Ack.

It is obviously correct, as names of MUME types cannot contain spaces,
it makes gitweb work with openSUSE /etc/mime.types, and it makes code
simpler.

> ---

Signoff (i.e. Signed-off-by)?

>  gitweb/gitweb.perl |    9 +++------
>  1 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 1b83a8d..d81d87b 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -3560,12 +3560,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);
> -- 
> 1.7.3.4
> 

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gitweb: allow space as delimiter in mime.types
  2011-06-14 14:59 ` Jakub Narebski
@ 2011-06-14 19:30   ` J.H.
  2011-06-14 21:28   ` Junio C Hamano
  1 sibling, 0 replies; 5+ messages in thread
From: J.H. @ 2011-06-14 19:30 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Ludwig Nussel, git

On 06/14/2011 07:59 AM, Jakub Narebski wrote:
> Ludwig Nussel <ludwig.nussel@suse.de> writes:
> 
>> Subject: [PATCH] gitweb: allow space as delimiter in mime.types
> 
> A very minor nitpick: perhaps "work with" rather than "allow" would be
> better?
> 
>> 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.
> 
> Ack.
> 
> It is obviously correct, as names of MUME types cannot contain spaces,
> it makes gitweb work with openSUSE /etc/mime.types, and it makes code
> simpler.

I agree with Jakub, Ack.

- John 'Warthog9' Hawley

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gitweb: allow space as delimiter in mime.types
  2011-06-14 14:59 ` Jakub Narebski
  2011-06-14 19:30   ` J.H.
@ 2011-06-14 21:28   ` Junio C Hamano
  2011-06-15  6:10     ` [PATCH v2] " Ludwig Nussel
  1 sibling, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2011-06-14 21:28 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Ludwig Nussel, git

Jakub Narebski <jnareb@gmail.com> writes:

> Ludwig Nussel <ludwig.nussel@suse.de> writes:
>
>> Subject: [PATCH] gitweb: allow space as delimiter in mime.types
>
> A very minor nitpick: perhaps "work with" rather than "allow" would be
> better?

Allow is good; we earlier didn't allow space to be treated as delimiter,
with this patch we will do.

>> 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.
>
> Ack.
>
> It is obviously correct, as names of MUME types cannot contain spaces,
> it makes gitweb work with openSUSE /etc/mime.types, and it makes code
> simpler.
>
>> ---
>
> Signoff (i.e. Signed-off-by)?

Yes, sign-off is missing and necessary.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] gitweb: allow space as delimiter in mime.types
  2011-06-14 21:28   ` Junio C Hamano
@ 2011-06-15  6:10     ` Ludwig Nussel
  0 siblings, 0 replies; 5+ messages in thread
From: Ludwig Nussel @ 2011-06-15  6:10 UTC (permalink / raw)
  To: git; +Cc: Ludwig Nussel

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>
---
 gitweb/gitweb.perl |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1b83a8d..d81d87b 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3560,12 +3560,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);
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-15  6:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-14 14:09 [PATCH] gitweb: allow space as delimiter in mime.types Ludwig Nussel
2011-06-14 14:59 ` Jakub Narebski
2011-06-14 19:30   ` J.H.
2011-06-14 21:28   ` Junio C Hamano
2011-06-15  6:10     ` [PATCH v2] " Ludwig Nussel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).