Bug 50434

Summary: file name based matching should not consider files that are named just ".extension"
Product: Apache httpd-2 Reporter: Christoph Anton Mitterer <calestyo>
Component: mod_mimeAssignee: Apache HTTPD Bugs Mailing List <bugs>
Severity: enhancement Keywords: FixedInTrunk
Priority: P2    
Version: 2.5-HEAD   
Target Milestone: ---   
Hardware: All   
OS: All   

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