mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Add flash mime type
This commit is contained in:
@@ -4,7 +4,7 @@ require 'yaml'
|
||||
# Register additional mime type extensions
|
||||
mime_extensions = YAML.load_file(File.expand_path("../mimes.yml", __FILE__))
|
||||
mime_extensions.each do |mime_type, exts|
|
||||
mime = MIME::Types[mime_type].first
|
||||
mime = MIME::Types[mime_type].first || MIME::Type.new(mime_type)
|
||||
exts.each { |ext| mime.extensions << ext }
|
||||
MIME::Types.index_extensions(mime)
|
||||
end
|
||||
|
||||
@@ -9,3 +9,6 @@ application/octet-stream:
|
||||
application/java-archive:
|
||||
- ear
|
||||
- war
|
||||
|
||||
application/x-shockwave-flash:
|
||||
- swf
|
||||
|
||||
@@ -17,6 +17,8 @@ class TestMime < Test::Unit::TestCase
|
||||
assert_equal 'application/sh', Mime.mime_for(".sh")
|
||||
assert_equal 'application/latex', Mime.mime_for(".latex")
|
||||
|
||||
assert_equal 'application/shockwave-flash', Mime.mime_for(".swf")
|
||||
|
||||
assert_equal 'application/octet-stream', Mime.mime_for(".dmg")
|
||||
assert_equal 'application/octet-stream', Mime.mime_for(".exe")
|
||||
assert_equal 'application/octet-stream', Mime.mime_for(".dll")
|
||||
@@ -38,6 +40,7 @@ class TestMime < Test::Unit::TestCase
|
||||
assert_equal 'text/plain; charset=utf-8', Mime.content_type_for(".sh")
|
||||
assert_equal 'text/plain; charset=utf-8', Mime.content_type_for(".latex")
|
||||
|
||||
assert_equal 'application/octet-stream', Mime.content_type_for(".swf")
|
||||
assert_equal 'application/octet-stream', Mime.content_type_for(".dmg")
|
||||
assert_equal 'application/octet-stream', Mime.content_type_for(".exe")
|
||||
assert_equal 'application/octet-stream', Mime.content_type_for(".dll")
|
||||
|
||||
Reference in New Issue
Block a user