Bug 50434 - file name based matching should not consider files that are named just ".extension"
Summary: file name based matching should not consider files that are named just ".exte...
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_mime (show other bugs)
Version: 2.5-HEAD
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Keywords: FixedInTrunk
Depends on:
Reported: 2010-12-08 09:05 UTC by Christoph Anton Mitterer
Modified: 2012-02-26 17:09 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Anton Mitterer 2010-12-08 09:05:46 UTC
Guess this is more or less related to issue #50357,... but I would suggest the following independently of that one.

When mod_mime determines type/charset/handler/encoding/etc. based on the file name by their extensions it should not consider the "first extension" of files that start with a ".".
e.g. having a file ".png" should _not_ lead to type "image/png", as it's (IMHO) more likely to be just a "hidden" file named "png" than a PNG picture.

I would however suggest to consider "secondary extensions" of files starting with a ".", e.g. ".png.ascii" is IMHO likely to be a "hidden" file, named "png", in ascii charset.

So for files starting with a ".":

This of course should also be done by the mappings set up via the TypeMap file.

This makes also indices generated by mod_autoindex looking more sane.
Comment 1 William A. Rowe Jr. 2010-12-08 13:10:25 UTC
Perhaps ignore all leading periods?  E.g. "..php" would not trigger a match either.
Comment 2 Christoph Anton Mitterer 2011-01-16 11:29:48 UTC
Hi William.

Yes, your suggestion is even better than mine :)

Guess that's the way to go!

Comment 3 Stefan Fritsch 2011-01-21 07:52:19 UTC
fixed in r1061791
Comment 4 Stefan Fritsch 2012-02-26 17:09:15 UTC
fixed in 2.4.1