aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_controller/mime_type.rb10
-rw-r--r--actionpack/test/controller/mime_type_test.rb1
2 files changed, 5 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/mime_type.rb b/actionpack/lib/action_controller/mime_type.rb
index ff65e18e44..f4d80c26c0 100644
--- a/actionpack/lib/action_controller/mime_type.rb
+++ b/actionpack/lib/action_controller/mime_type.rb
@@ -34,11 +34,11 @@ module Mime
def parse(accept_header)
# keep track of creation order to keep the subsequent sort stable
index = 0
- list = accept_header.split(/,/).
- map! { |i| AcceptItem.new(index += 1, *i.split(/;\s*q=/)) }.sort!
+ list = accept_header.split(/,/).map! do |i|
+ AcceptItem.new(index += 1, *i.split(/;\s*q=/))
+ end.sort!
# Take care of the broken text/xml entry by renaming or deleting it
-
text_xml = list.index("text/xml")
app_xml = list.index("application/xml")
@@ -120,7 +120,7 @@ module Mime
YAML = Type.new "application/x-yaml", :yaml, %w( text/yaml )
- LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) }
+ LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) unless k == "" }
LOOKUP["*/*"] = ALL
@@ -142,7 +142,7 @@ module Mime
LOOKUP["application/atom+xml"] = ATOM
- EXTENSION_LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) }
+ EXTENSION_LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) unless k == "" }
EXTENSION_LOOKUP["html"] = HTML
EXTENSION_LOOKUP["xhtml"] = HTML
diff --git a/actionpack/test/controller/mime_type_test.rb b/actionpack/test/controller/mime_type_test.rb
index 49869d647e..aa1d4459ee 100644
--- a/actionpack/test/controller/mime_type_test.rb
+++ b/actionpack/test/controller/mime_type_test.rb
@@ -5,7 +5,6 @@ class MimeTypeTest < Test::Unit::TestCase
Mime::PLAIN = Mime::Type.new("text/plain")
def test_parse_single
-p Mime::LOOKUP.keys.sort
Mime::LOOKUP.keys.each do |mime_type|
assert_equal [Mime::Type.lookup(mime_type)], Mime::Type.parse(mime_type)
end