diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-02-07 18:06:35 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-02-07 18:06:35 +0000 |
commit | 6d109258c909f71edc3a4b43843c296acf66aad0 (patch) | |
tree | 6f37f365ee296296de251fb4236e1e0739ce8e22 /lib/redmine | |
parent | 9a2ec76a81d2c97c0ccc33452c2ef4557016a0a5 (diff) | |
download | redmine-6d109258c909f71edc3a4b43843c296acf66aad0.tar.gz redmine-6d109258c909f71edc3a4b43843c296acf66aad0.zip |
Added a few extensions/mimetypes.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1128 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine')
-rw-r--r-- | lib/redmine/mime_type.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/redmine/mime_type.rb b/lib/redmine/mime_type.rb index c9db93956..e0bc3991d 100644 --- a/lib/redmine/mime_type.rb +++ b/lib/redmine/mime_type.rb @@ -19,7 +19,7 @@ module Redmine module MimeType MIME_TYPES = { - 'text/plain' => 'txt,tpl,properties', + 'text/plain' => 'txt,tpl,properties,patch,diff,ini,readme,install,upgrade', 'text/css' => 'css', 'text/html' => 'html,htm,xhtml', 'text/x-c' => 'c,cpp,h', @@ -30,25 +30,28 @@ module Redmine 'text/x-php' => 'php,php3,php4,php5', 'text/x-python' => 'py', 'text/x-ruby' => 'rb,rbw,ruby,rake', + 'text/x-csh' => 'csh', 'text/x-sh' => 'sh', - 'text/xml' => 'xml', + 'text/xml' => 'xml,xsd,mxml', 'text/yaml' => 'yml,yaml', 'image/gif' => 'gif', 'image/jpeg' => 'jpg,jpeg,jpe', 'image/png' => 'png', - 'image/tiff' => 'tiff,tif' + 'image/tiff' => 'tiff,tif', + 'image/x-ms-bmp' => 'bmp', + 'image/x-xpixmap' => 'xpm', }.freeze EXTENSIONS = MIME_TYPES.inject({}) do |map, (type, exts)| - exts.split(',').each {|ext| map[ext] = type} + exts.split(',').each {|ext| map[ext.strip] = type} map end # returns mime type for name or nil if unknown def self.of(name) return nil unless name - m = name.to_s.match(/\.([^\.]+)$/) - EXTENSIONS[m[1]] if m + m = name.to_s.match(/(^|\.)([^\.]+)$/) + EXTENSIONS[m[2].downcase] if m end def self.main_mimetype_of(name) |