git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Martin Waitz <tali@admingilde.org>
Cc: git@vger.kernel.org
Subject: [PATCH] gitweb: Fix mimetype_guess_file for files with multiple extensions
Date: Tue, 19 Sep 2006 13:57:03 +0200	[thread overview]
Message-ID: <200609191357.03796.jnareb@gmail.com> (raw)
In-Reply-To: <20060919082925.GC31940@admingilde.org>

Fix getting correct mimetype for "blob_plain" view for files which have
multiple extensions, e.g. foo.1.html; now only the last extension
is used to find mimetype.

Noticed by Martin Waitz.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This is much simpler (and faster!) correction to the mentioned problem.
I just don't grok regular expressions, not completly.

 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 01fae94..034cdf1 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1199,7 +1199,7 @@ sub mimetype_guess_file {
 	}
 	close(MIME);
 
-	$filename =~ /\.(.*?)$/;
+	$filename =~ /\.([^.]*)$/;
 	return $mimemap{$1};
 }
 
-- 
1.4.2.1

  reply	other threads:[~2006-09-19 11:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-16 21:09 [PATCH] gitweb: use correct mime type even if filename has multiple dots Martin Waitz
2006-09-16 21:44 ` Jakub Narebski
2006-09-17  7:51   ` Martin Waitz
2006-09-17  8:23     ` Jakub Narebski
2006-09-19  8:29       ` Martin Waitz
2006-09-19 11:57         ` Jakub Narebski [this message]
2006-09-17  8:41     ` Junio C Hamano
2006-09-17  8:56       ` Jakub Narebski
2006-09-17  9:07         ` Junio C Hamano
2006-09-19  9:23       ` Martin Waitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200609191357.03796.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=tali@admingilde.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).