aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/mime_type.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-06-01 23:23:24 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-06-01 23:23:24 +0000
commit9e7e89a5611d7c798018c318b612a5ba046d8947 (patch)
tree539ccde5c5c600ddff4a7d45cf18fe7bc4057637 /actionpack/lib/action_controller/mime_type.rb
parentc9eb5a083f0cf120fe7c3c1e19ead5cfc777b1fe (diff)
downloadrails-9e7e89a5611d7c798018c318b612a5ba046d8947.tar.gz
rails-9e7e89a5611d7c798018c318b612a5ba046d8947.tar.bz2
rails-9e7e89a5611d7c798018c318b612a5ba046d8947.zip
Dont keep nothing as a lookup [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4399 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/mime_type.rb')
-rw-r--r--actionpack/lib/action_controller/mime_type.rb10
1 files changed, 5 insertions, 5 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