[DRE-commits] [ruby-actionpack-3.2] 01/08: New upstream version 3.2.16
Ondrej Sury
ondrej at moszumanska.debian.org
Sun Dec 15 15:37:28 UTC 2013
This is an automated email from the git hooks/post-receive script.
ondrej pushed a commit to branch master
in repository ruby-actionpack-3.2.
commit 26f8a9e48d781bb757c689731001cc38955b7813
Author: Ondřej Surý <ondrej at sury.org>
Date: Wed Dec 4 17:40:26 2013 +0100
New upstream version 3.2.16
---
CHANGELOG.md | 136 ++++++++++++++++++++-
checksums.yaml.gz | Bin 265 -> 264 bytes
lib/action_controller/log_subscriber.rb | 11 +-
lib/action_controller/metal/hide_actions.rb | 2 +-
lib/action_controller/test_case.rb | 29 +++--
lib/action_dispatch/http/mime_negotiation.rb | 4 +-
lib/action_dispatch/http/request.rb | 4 +-
lib/action_dispatch/middleware/remote_ip.rb | 2 +-
lib/action_dispatch/routing/mapper.rb | 11 +-
lib/action_dispatch/routing/route_set.rb | 15 +--
lib/action_dispatch/testing/assertions/response.rb | 2 +-
lib/action_dispatch/testing/assertions/routing.rb | 6 +-
lib/action_pack/version.rb | 2 +-
lib/action_view/asset_paths.rb | 2 +-
lib/action_view/helpers/date_helper.rb | 2 +-
lib/action_view/helpers/form_helper.rb | 15 ++-
lib/action_view/helpers/number_helper.rb | 8 +-
lib/action_view/helpers/translation_helper.rb | 21 ++--
lib/action_view/helpers/url_helper.rb | 2 +-
lib/action_view/lookup_context.rb | 15 ++-
lib/sprockets/helpers/rails_helper.rb | 2 +-
metadata.yml | 51 ++++----
22 files changed, 248 insertions(+), 94 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f1eb9e8..ff72af7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,9 +1,137 @@
-## unreleased ##
+* Deep Munge the parameters for GET and POST Fixes CVE-2013-6417
-* No changes.
+* Stop using i18n's built in HTML error handling. Fixes: CVE-2013-4491
+
+* Escape the unit value provided to number_to_currency Fixes CVE-2013-6415
+
+* Only use valid mime type symbols as cache keys CVE-2013-6414
+
+## Rails 3.2.15 (Oct 16, 2013) ##
+
+* Fix `ActionDispatch::RemoteIp::GetIp#calculate_ip` to only check for spoofing
+ attacks if both `HTTP_CLIENT_IP` and `HTTP_X_FORWARDED_FOR` are set.
+
+ Fixes #12410
+ Backports #10844
+
+ *Tamir Duberstein*
+
+* Fix the assert_recognizes test method so that it works when there are
+ constraints on the querystring.
+
+ Issue/Pull Request #9368
+ Backport #5219
+
+ *Brian Hahn*
+
+* Fix to render partial by context(#11605).
+
+ *Kassio Borges*
+
+* Fix `ActionDispatch::Assertions::ResponseAssertions#assert_redirected_to`
+ does not show user-supplied message.
+
+ Issue: when `assert_redirected_to` fails due to the response redirect not
+ matching the expected redirect the user-supplied message (second parameter)
+ is not shown. This message is only shown if the response is not a redirect.
+
+ *Alexey Chernenkov*
+
+
+## Rails 3.2.14 (Jul 22, 2013) ##
+
+* Merge `:action` from routing scope and assign endpoint if both `:controller`
+ and `:action` are present. The endpoint assignment only occurs if there is
+ no `:to` present in the options hash so should only affect routes using the
+ shorthand syntax (i.e. endpoint is inferred from the the path).
+
+ Fixes #9856
+
+ *Yves Senn*, *Andrew White*
+
+* Always escape the result of `link_to_unless` method.
+
+ Before:
+
+ link_to_unless(true, '<b>Showing</b>', 'github.com')
+ # => "<b>Showing</b>"
+
+ After:
+
+ link_to_unless(true, '<b>Showing</b>', 'github.com')
+ # => "<b>Showing</b>"
+
+ *dtaniwaki*
+
+* Use a case insensitive URI Regexp for #asset_path.
+
+ This fix a problem where the same asset path using different case are generating
+ different URIs.
+
+ Before:
+
+ image_tag("HTTP://google.com")
+ # => "<img alt=\"Google\" src=\"/assets/HTTP://google.com\" />"
+ image_tag("http://google.com")
+ # => "<img alt=\"Google\" src=\"http://google.com\" />"
+
+ After:
+
+ image_tag("HTTP://google.com")
+ # => "<img alt=\"Google\" src=\"HTTP://google.com\" />"
+ image_tag("http://google.com")
+ # => "<img alt=\"Google\" src=\"http://google.com\" />"
+
+ *David Celis + Rafael Mendonça França*
+
+* Fix explicit names on multiple file fields. If a file field tag has
+ the multiple option, it is turned into an array field (appending `[]`),
+ but if an explicit name is passed to `file_field` the `[]` is not
+ appended.
+ Fixes #9830.
+
+ *Ryan McGeary*
+
+* Fix assets loading performance in 3.2.13.
+
+ Issue #8756 uses Sprockets for resolving files that already exist on disk,
+ for those files their extensions don't need to be rewritten.
+
+ Fixes #9803.
+
+ *Fred Wu*
+
+* Fix `ActionController#action_missing` not being called.
+ Fixes #9799.
+
+ *Janko Luin*
+
+* `ActionView::Helpers::NumberHelper#number_to_human` returns the number unaltered when
+ the units hash does not contain the needed key, e.g. when the number provided is less
+ than the largest key provided.
+
+ Examples:
+
+ number_to_human(123, units: {}) # => 123
+ number_to_human(123, units: { thousand: 'k' }) # => 123
+
+ Fixes #9269.
+ Backport #9347.
+
+ *Michael Hoffman*
+
+* Include I18n locale fallbacks in view lookup.
+ Fixes GH#3512.
+
+ *Juan Barreneche*
+
+* Fix `ActionDispatch::Request#formats` when the Accept request-header is an
+ empty string. Fix #7774 [Backport #8977, #9541]
+
+ *Soylent + Maxime Réty*
-## Rails 3.2.13 (Feb 17, 2013) ##
+## Rails 3.2.13 (Mar 18, 2013) ##
* Fix incorrectly appended square brackets to a multiple select box
if an explicit name has been given and it already ends with "[]".
@@ -43,7 +171,7 @@
*Sergey Nartimov*
-* Eagerly populate the http method loookup cache so local project inflections do
+* Eagerly populate the http method lookup cache so local project inflections do
not interfere with use of underscore method ( and we don't need locks )
*Aditya Sanghi*
diff --git a/checksums.yaml.gz b/checksums.yaml.gz
index 168ad44..c210cc3 100644
Binary files a/checksums.yaml.gz and b/checksums.yaml.gz differ
diff --git a/lib/action_controller/log_subscriber.rb b/lib/action_controller/log_subscriber.rb
index 194f26a..f2545ef 100644
--- a/lib/action_controller/log_subscriber.rb
+++ b/lib/action_controller/log_subscriber.rb
@@ -23,7 +23,7 @@ module ActionController
exception_class_name = payload[:exception].first
status = ActionDispatch::ExceptionWrapper.status_code_for_exception(exception_class_name)
end
- message = "Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in %.0fms" % event.duration
+ message = "Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in #{format_duration(event.duration)}"
message << " (#{additions.join(" | ")})" unless additions.blank?
info(message)
@@ -34,9 +34,7 @@ module ActionController
end
def send_file(event)
- message = "Sent file %s"
- message << " (%.1fms)"
- info(message % [event.payload[:path], event.duration])
+ info("Sent file #{event.payload[:path]} (#{format_duration(event.duration)})")
end
def redirect_to(event)
@@ -44,7 +42,7 @@ module ActionController
end
def send_data(event)
- info("Sent data %s (%.1fms)" % [event.payload[:filename], event.duration])
+ info("Sent data #{event.payload[:filename]} (#{format_duration(event.duration)})")
end
%w(write_fragment read_fragment exist_fragment?
@@ -53,7 +51,8 @@ module ActionController
def #{method}(event)
key_or_path = event.payload[:key] || event.payload[:path]
human_name = #{method.to_s.humanize.inspect}
- info("\#{human_name} \#{key_or_path} \#{"(%.1fms)" % event.duration}")
+ duration = format_duration(event.duration)
+ info("\#{human_name} \#{key_or_path} \#{duration}")
end
METHOD
end
diff --git a/lib/action_controller/metal/hide_actions.rb b/lib/action_controller/metal/hide_actions.rb
index 109484d..1ded166 100644
--- a/lib/action_controller/metal/hide_actions.rb
+++ b/lib/action_controller/metal/hide_actions.rb
@@ -28,7 +28,7 @@ module ActionController
end
def visible_action?(action_name)
- action_methods.include?(action_name)
+ not hidden_actions.include?(action_name)
end
# Overrides AbstractController::Base#action_methods to remove any methods
diff --git a/lib/action_controller/test_case.rb b/lib/action_controller/test_case.rb
index bc6828a..e089fee 100644
--- a/lib/action_controller/test_case.rb
+++ b/lib/action_controller/test_case.rb
@@ -20,7 +20,12 @@ module ActionController
ActiveSupport::Notifications.subscribe("render_template.action_view") do |name, start, finish, id, payload|
path = payload[:layout]
- @layouts[path] += 1
+ if path
+ @layouts[path] += 1
+ if path =~ /^layouts\/(.*)/
+ @layouts[$1] += 1
+ end
+ end
end
ActiveSupport::Notifications.subscribe("!render_template.action_view") do |name, start, finish, id, payload|
@@ -56,6 +61,15 @@ module ActionController
# # assert that the "new" view template was rendered
# assert_template "new"
#
+ # # assert that the layout 'admin' was rendered
+ # assert_template :layout => 'admin'
+ # assert_template :layout => 'layouts/admin'
+ # assert_template :layout => :admin
+ #
+ # # assert that no layout was rendered
+ # assert_template :layout => nil
+ # assert_template :layout => false
+ #
# # assert that the "_customer" partial was rendered twice
# assert_template :partial => '_customer', :count => 2
#
@@ -88,17 +102,18 @@ module ActionController
end
end
when Hash
- if expected_layout = options[:layout]
+ if options.key?(:layout)
+ expected_layout = options[:layout]
msg = build_message(message,
"expecting layout <?> but action rendered <?>",
expected_layout, @layouts.keys)
case expected_layout
- when String
- assert(@layouts.keys.include?(expected_layout), msg)
+ when String, Symbol
+ assert(@layouts.keys.include?(expected_layout.to_s), msg)
when Regexp
assert(@layouts.keys.any? {|l| l =~ expected_layout }, msg)
- when nil
+ when nil, false
assert(@layouts.empty?, msg)
end
end
@@ -125,7 +140,7 @@ module ActionController
options[:partial], @partials.keys)
assert(@partials.include?(expected_partial), msg)
end
- else
+ elsif options.key?(:partial)
assert @partials.empty?,
"Expected no partials to be rendered"
end
@@ -460,7 +475,7 @@ module ActionController
parameters ||= {}
controller_class_name = @controller.class.anonymous? ?
"anonymous_controller" :
- @controller.class.name.underscore.sub(/_controller$/, '')
+ @controller.class.controller_path
@request.assign_parameters(@routes, controller_class_name, action.to_s, parameters)
diff --git a/lib/action_dispatch/http/mime_negotiation.rb b/lib/action_dispatch/http/mime_negotiation.rb
index 5c48a60..42f14bc 100644
--- a/lib/action_dispatch/http/mime_negotiation.rb
+++ b/lib/action_dispatch/http/mime_negotiation.rb
@@ -98,8 +98,8 @@ module ActionDispatch
BROWSER_LIKE_ACCEPTS = /,\s*\*\/\*|\*\/\*\s*,/
def valid_accept_header
- (xhr? && (accept || content_mime_type)) ||
- (accept && accept !~ BROWSER_LIKE_ACCEPTS)
+ (xhr? && (accept.present? || content_mime_type)) ||
+ (accept.present? && accept !~ BROWSER_LIKE_ACCEPTS)
end
def use_accept_header
diff --git a/lib/action_dispatch/http/request.rb b/lib/action_dispatch/http/request.rb
index 3115573..0f92b82 100644
--- a/lib/action_dispatch/http/request.rb
+++ b/lib/action_dispatch/http/request.rb
@@ -228,13 +228,13 @@ module ActionDispatch
# Override Rack's GET method to support indifferent access
def GET
- @env["action_dispatch.request.query_parameters"] ||= (normalize_parameters(super) || {})
+ @env["action_dispatch.request.query_parameters"] ||= deep_munge(normalize_parameters(super) || {})
end
alias :query_parameters :GET
# Override Rack's POST method to support indifferent access
def POST
- @env["action_dispatch.request.request_parameters"] ||= (normalize_parameters(super) || {})
+ @env["action_dispatch.request.request_parameters"] ||= deep_munge(normalize_parameters(super) || {})
end
alias :request_parameters :POST
diff --git a/lib/action_dispatch/middleware/remote_ip.rb b/lib/action_dispatch/middleware/remote_ip.rb
index 66ece60..f4545bd 100644
--- a/lib/action_dispatch/middleware/remote_ip.rb
+++ b/lib/action_dispatch/middleware/remote_ip.rb
@@ -49,7 +49,7 @@ module ActionDispatch
forwarded_ips = ips_from('HTTP_X_FORWARDED_FOR')
remote_addrs = ips_from('REMOTE_ADDR')
- check_ip = client_ip && @middleware.check_ip
+ check_ip = client_ip && forwarded_ips.present? && @middleware.check_ip
if check_ip && !forwarded_ips.include?(client_ip)
# We don't know which came from the proxy, and which from the user
raise IpSpoofAttackError, "IP spoofing attack?!" \
diff --git a/lib/action_dispatch/routing/mapper.rb b/lib/action_dispatch/routing/mapper.rb
index 6b27270..8e28e0d 100644
--- a/lib/action_dispatch/routing/mapper.rb
+++ b/lib/action_dispatch/routing/mapper.rb
@@ -1,6 +1,7 @@
require 'active_support/core_ext/hash/except'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/object/inclusion'
+require 'active_support/core_ext/enumerable'
require 'active_support/inflector'
require 'action_dispatch/routing/redirection'
@@ -67,8 +68,6 @@ module ActionDispatch
private
def normalize_options!
- path_without_format = @path.sub(/\(\.:format\)$/, '')
-
@options.merge!(default_controller_and_action)
requirements.each do |name, requirement|
@@ -781,6 +780,10 @@ module ActionDispatch
child
end
+ def merge_action_scope(parent, child) #:nodoc:
+ child
+ end
+
def merge_path_names_scope(parent, child) #:nodoc:
merge_options_scope(parent, child)
end
@@ -1255,6 +1258,10 @@ module ActionDispatch
paths = [path] + rest
end
+ if @scope[:controller] && @scope[:action]
+ options[:to] ||= "#{@scope[:controller]}##{@scope[:action]}"
+ end
+
path_without_format = path.to_s.sub(/\(\.:format\)$/, '')
if using_match_shorthand?(path_without_format, options)
options[:to] ||= path_without_format.gsub(%r{^/}, "").sub(%r{/([^/]*)$}, '#\1')
diff --git a/lib/action_dispatch/routing/route_set.rb b/lib/action_dispatch/routing/route_set.rb
index a993699..d9671a4 100644
--- a/lib/action_dispatch/routing/route_set.rb
+++ b/lib/action_dispatch/routing/route_set.rb
@@ -97,9 +97,7 @@ module ActionDispatch
@routes = {}
@helpers = []
- @module = Module.new do
- instance_methods.each { |selector| remove_method(selector) }
- end
+ @module = Module.new
end
def helper_names
@@ -108,13 +106,11 @@ module ActionDispatch
def clear!
@helpers.each do |helper|
- @module.module_eval do
- remove_possible_method helper
- end
+ @module.remove_possible_method helper
end
- @routes = {}
- @helpers = []
+ @routes.clear
+ @helpers.clear
end
def add(name, route)
@@ -615,9 +611,10 @@ module ActionDispatch
def recognize_path(path, environment = {})
method = (environment[:method] || "GET").to_s.upcase
path = Journey::Router::Utils.normalize_path(path) unless path =~ %r{://}
+ extras = environment[:extras] || {}
begin
- env = Rack::MockRequest.env_for(path, {:method => method})
+ env = Rack::MockRequest.env_for(path, {:method => method, :params => extras})
rescue URI::InvalidURIError => e
raise ActionController::RoutingError, e.message
end
diff --git a/lib/action_dispatch/testing/assertions/response.rb b/lib/action_dispatch/testing/assertions/response.rb
index 6886ff2..cd3329c 100644
--- a/lib/action_dispatch/testing/assertions/response.rb
+++ b/lib/action_dispatch/testing/assertions/response.rb
@@ -62,7 +62,7 @@ module ActionDispatch
redirect_expected = normalize_argument_to_redirection(options)
if redirect_is != redirect_expected
- flunk "Expected response to be a redirect to <#{redirect_expected}> but was a redirect to <#{redirect_is}>"
+ flunk(build_message(message, "Expected response to be a redirect to <?> but was a redirect to <?>", redirect_expected, redirect_is))
end
end
diff --git a/lib/action_dispatch/testing/assertions/routing.rb b/lib/action_dispatch/testing/assertions/routing.rb
index b10aab9..2a25d3f 100644
--- a/lib/action_dispatch/testing/assertions/routing.rb
+++ b/lib/action_dispatch/testing/assertions/routing.rb
@@ -39,7 +39,7 @@ module ActionDispatch
# # Test a custom route
# assert_recognizes({:controller => 'items', :action => 'show', :id => '1'}, 'view/item1')
def assert_recognizes(expected_options, path, extras={}, message=nil)
- request = recognized_request_for(path)
+ request = recognized_request_for(path, extras)
expected_options = expected_options.clone
extras.each_key { |key| expected_options.delete key } unless extras.nil?
@@ -179,7 +179,7 @@ module ActionDispatch
private
# Recognizes the route for a given path.
- def recognized_request_for(path)
+ def recognized_request_for(path, extras = {})
if path.is_a?(Hash)
method = path[:method]
path = path[:path]
@@ -207,7 +207,7 @@ module ActionDispatch
request.request_method = method if method
- params = @routes.recognize_path(path, { :method => method })
+ params = @routes.recognize_path(path, { :method => method, :extras => extras })
request.path_parameters = params.with_indifferent_access
request
diff --git a/lib/action_pack/version.rb b/lib/action_pack/version.rb
index f319266..33d221e 100644
--- a/lib/action_pack/version.rb
+++ b/lib/action_pack/version.rb
@@ -2,7 +2,7 @@ module ActionPack
module VERSION #:nodoc:
MAJOR = 3
MINOR = 2
- TINY = 13
+ TINY = 16
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
diff --git a/lib/action_view/asset_paths.rb b/lib/action_view/asset_paths.rb
index c192d37..636a37b 100644
--- a/lib/action_view/asset_paths.rb
+++ b/lib/action_view/asset_paths.rb
@@ -43,7 +43,7 @@ module ActionView
end
def is_uri?(path)
- path =~ %r{^[-a-z]+://|^(?:cid|data):|^//}
+ path =~ %r{^[-a-z]+://|^(?:cid|data):|^//}i
end
private
diff --git a/lib/action_view/helpers/date_helper.rb b/lib/action_view/helpers/date_helper.rb
index 99aa144..39b9a8d 100644
--- a/lib/action_view/helpers/date_helper.rb
+++ b/lib/action_view/helpers/date_helper.rb
@@ -112,7 +112,7 @@ module ActionView
# english it would read better as about 80 years.
minutes_with_offset = distance_in_minutes - minute_offset_for_leap_year
remainder = (minutes_with_offset % 525600)
- distance_in_years = (minutes_with_offset / 525600)
+ distance_in_years = (minutes_with_offset.div 525600)
if remainder < 131400
locale.t(:about_x_years, :count => distance_in_years)
elsif remainder < 394200
diff --git a/lib/action_view/helpers/form_helper.rb b/lib/action_view/helpers/form_helper.rb
index 920dc3f..0c07925 100644
--- a/lib/action_view/helpers/form_helper.rb
+++ b/lib/action_view/helpers/form_helper.rb
@@ -1196,27 +1196,26 @@ module ActionView
def add_default_name_and_id(options)
if options.has_key?("index")
- options["name"] ||= tag_name_with_index(options["index"])
+ options["name"] ||= tag_name_with_index(options["index"], options["multiple"])
options["id"] = options.fetch("id"){ tag_id_with_index(options["index"]) }
options.delete("index")
elsif defined?(@auto_index)
- options["name"] ||= tag_name_with_index(@auto_index)
+ options["name"] ||= tag_name_with_index(@auto_index, options["multiple"])
options["id"] = options.fetch("id"){ tag_id_with_index(@auto_index) }
else
- options["name"] ||= tag_name
+ options["name"] ||= tag_name(options["multiple"])
options["id"] = options.fetch("id"){ tag_id }
end
- options["name"] += "[]" if options["multiple"] && !options["name"].ends_with?("[]")
options["id"] = [options.delete('namespace'), options["id"]].compact.join("_").presence
end
- def tag_name
- "#{@object_name}[#{sanitized_method_name}]"
+ def tag_name(multiple = false)
+ "#{@object_name}[#{sanitized_method_name}]#{"[]" if multiple}"
end
- def tag_name_with_index(index)
- "#{@object_name}[#{index}][#{sanitized_method_name}]"
+ def tag_name_with_index(index, multiple = false)
+ "#{@object_name}[#{index}][#{sanitized_method_name}]#{"[]" if multiple}"
end
def tag_id
diff --git a/lib/action_view/helpers/number_helper.rb b/lib/action_view/helpers/number_helper.rb
index b627c77..eee9e59 100644
--- a/lib/action_view/helpers/number_helper.rb
+++ b/lib/action_view/helpers/number_helper.rb
@@ -156,7 +156,7 @@ module ActionView
begin
value = number_with_precision(number, options.merge(:raise => true))
- format.gsub(/%n/, value).gsub(/%u/, unit).html_safe
+ format.gsub(/%n/, ERB::Util.html_escape(value)).gsub(/%u/, ERB::Util.html_escape(unit)).html_safe
rescue InvalidNumberError => e
if options[:raise]
raise
@@ -360,7 +360,7 @@ module ActionView
end
- STORAGE_UNITS = [:byte, :kb, :mb, :gb, :tb].freeze
+ STORAGE_UNITS = [:byte, :kb, :mb, :gb, :tb]
# Formats the bytes in +number+ into a more understandable
# representation (e.g., giving it 1500 yields 1.5 KB). This
@@ -452,7 +452,7 @@ module ActionView
end
DECIMAL_UNITS = {0 => :unit, 1 => :ten, 2 => :hundred, 3 => :thousand, 6 => :million, 9 => :billion, 12 => :trillion, 15 => :quadrillion,
- -1 => :deci, -2 => :centi, -3 => :mili, -6 => :micro, -9 => :nano, -12 => :pico, -15 => :femto}.freeze
+ -1 => :deci, -2 => :centi, -3 => :mili, -6 => :micro, -9 => :nano, -12 => :pico, -15 => :femto}
# Pretty prints (formats and approximates) a number in a way it
# is more readable by humans (eg.: 1200000000 becomes "1.2
@@ -593,7 +593,7 @@ module ActionView
unit = case units
when Hash
- units[DECIMAL_UNITS[display_exponent]]
+ units[DECIMAL_UNITS[display_exponent]] || ''
when String, Symbol
I18n.translate(:"#{units}.#{DECIMAL_UNITS[display_exponent]}", :locale => options[:locale], :count => number.to_i)
else
diff --git a/lib/action_view/helpers/translation_helper.rb b/lib/action_view/helpers/translation_helper.rb
index cc74eff..6ef652d 100644
--- a/lib/action_view/helpers/translation_helper.rb
+++ b/lib/action_view/helpers/translation_helper.rb
@@ -1,24 +1,14 @@
require 'action_view/helpers/tag_helper'
require 'i18n/exceptions'
-module I18n
- class ExceptionHandler
- include Module.new {
- def call(exception, locale, key, options)
- exception.is_a?(MissingTranslation) && options[:rescue_format] == :html ? super.html_safe : super
- end
- }
- end
-end
-
module ActionView
# = Action View Translation Helpers
module Helpers
module TranslationHelper
# Delegates to <tt>I18n#translate</tt> but also performs three additional functions.
#
- # First, it'll pass the <tt>:rescue_format => :html</tt> option to I18n so that any
- # thrown +MissingTranslation+ messages will be turned into inline spans that
+ # First, it will ensure that any thrown +MissingTranslation+ messages will be turned
+ # into inline spans that:
#
# * have a "translation-missing" class set,
# * contain the missing key as a title attribute and
@@ -44,7 +34,9 @@ module ActionView
# naming convention helps to identify translations that include HTML tags so that
# you know what kind of output to expect when you call translate in a template.
def translate(key, options = {})
- options.merge!(:rescue_format => :html) unless options.key?(:rescue_format)
+ # If the user has specified rescue_format then pass it all through, otherwise use
+ # raise and do the work ourselves
+ options[:raise] = true unless options.key?(:raise) || options.key?(:rescue_format)
if html_safe_translation_key?(key)
html_safe_options = options.dup
options.except(*I18n::RESERVED_KEYS).each do |name, value|
@@ -58,6 +50,9 @@ module ActionView
else
I18n.translate(scope_key_by_partial(key), options)
end
+ rescue I18n::MissingTranslationData => e
+ keys = I18n.normalize_keys(e.locale, e.key, e.options[:scope])
+ content_tag('span', keys.last.to_s.titleize, :class => 'translation_missing', :title => "translation missing: #{keys.join('.')}")
end
alias :t :translate
diff --git a/lib/action_view/helpers/url_helper.rb b/lib/action_view/helpers/url_helper.rb
index 812bb4d..51c3100 100644
--- a/lib/action_view/helpers/url_helper.rb
+++ b/lib/action_view/helpers/url_helper.rb
@@ -422,7 +422,7 @@ module ActionView
if block_given?
block.arity <= 1 ? capture(name, &block) : capture(name, options, html_options, &block)
else
- name
+ ERB::Util.html_escape(name)
end
else
link_to(name, options, html_options)
diff --git a/lib/action_view/lookup_context.rb b/lib/action_view/lookup_context.rb
index 33b508e..9331d13 100644
--- a/lib/action_view/lookup_context.rb
+++ b/lib/action_view/lookup_context.rb
@@ -44,7 +44,13 @@ module ActionView
module Accessors #:nodoc:
end
- register_detail(:locale) { [I18n.locale, I18n.default_locale].uniq }
+ register_detail(:locale) do
+ locales = [I18n.locale]
+ locales.concat(I18n.fallbacks[I18n.locale]) if I18n.respond_to? :fallbacks
+ locales << I18n.default_locale
+ locales.uniq!
+ locales
+ end
register_detail(:formats) { Mime::SET.symbols }
register_detail(:handlers){ Template::Handlers.extensions }
@@ -56,6 +62,13 @@ module ActionView
@details_keys = Hash.new
def self.get(details)
+ if details[:formats]
+ details = details.dup
+ syms = Set.new Mime::SET.symbols
+ details[:formats] = details[:formats].select { |v|
+ syms.include? v
+ }
+ end
@details_keys[details] ||= new
end
diff --git a/lib/sprockets/helpers/rails_helper.rb b/lib/sprockets/helpers/rails_helper.rb
index 51f0cbb..243c2e5 100644
--- a/lib/sprockets/helpers/rails_helper.rb
+++ b/lib/sprockets/helpers/rails_helper.rb
@@ -163,7 +163,7 @@ module Sprockets
source
elsif source_ext.blank?
"#{source}.#{ext}"
- elsif exact_match_present?(source)
+ elsif File.exists?(source) || exact_match_present?(source)
source
else
"#{source}.#{ext}"
diff --git a/metadata.yml b/metadata.yml
index 4c89abf..85a1d8e 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: actionpack
version: !ruby/object:Gem::Version
- version: 3.2.13
+ version: 3.2.16
platform: ruby
authors:
- David Heinemeier Hansson
autorequire:
bindir: bin
cert_chain: []
-date: 2013-03-18 00:00:00.000000000 Z
+date: 2013-12-03 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: activesupport
@@ -16,138 +16,138 @@ dependencies:
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 3.2.13
+ version: 3.2.16
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 3.2.13
+ version: 3.2.16
- !ruby/object:Gem::Dependency
name: activemodel
requirement: !ruby/object:Gem::Requirement
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 3.2.13
+ version: 3.2.16
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 3.2.13
+ version: 3.2.16
- !ruby/object:Gem::Dependency
name: rack-cache
requirement: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: '1.2'
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: '1.2'
- !ruby/object:Gem::Dependency
name: builder
requirement: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: 3.0.0
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: 3.0.0
- !ruby/object:Gem::Dependency
name: rack
requirement: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: 1.4.5
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: 1.4.5
- !ruby/object:Gem::Dependency
name: rack-test
requirement: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: 0.6.1
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: 0.6.1
- !ruby/object:Gem::Dependency
name: journey
requirement: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: 1.0.4
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: 1.0.4
- !ruby/object:Gem::Dependency
name: sprockets
requirement: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: 2.2.1
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: 2.2.1
- !ruby/object:Gem::Dependency
name: erubis
requirement: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: 2.7.0
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: 2.7.0
- !ruby/object:Gem::Dependency
name: tzinfo
requirement: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: 0.3.29
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - - ~>
+ - - "~>"
- !ruby/object:Gem::Version
version: 0.3.29
description: Web apps on Rails. Simple, battle-tested conventions for building and
@@ -349,7 +349,8 @@ files:
- lib/sprockets/railtie.rb
- lib/sprockets/static_compiler.rb
homepage: http://www.rubyonrails.org
-licenses: []
+licenses:
+- MIT
metadata: {}
post_install_message:
rdoc_options: []
@@ -357,12 +358,12 @@ require_paths:
- lib
required_ruby_version: !ruby/object:Gem::Requirement
requirements:
- - - '>='
+ - - ">="
- !ruby/object:Gem::Version
version: 1.8.7
required_rubygems_version: !ruby/object:Gem::Requirement
requirements:
- - - '>='
+ - - ">="
- !ruby/object:Gem::Version
version: '0'
requirements:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-actionpack-3.2.git
More information about the Pkg-ruby-extras-commits
mailing list