mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix the */* with Net::HTTP bug [#3100 state:resolved]
This commit is contained in:
parent
bd53ebde72
commit
66a4585f88
3 changed files with 16 additions and 26 deletions
|
@ -72,26 +72,10 @@ module ActionView
|
|||
@path = Pathname.new(path).expand_path
|
||||
end
|
||||
|
||||
# TODO: This is the currently needed API. Make this suck less
|
||||
# ==== <suck>
|
||||
attr_reader :path
|
||||
|
||||
def to_s
|
||||
path.to_s
|
||||
@path.to_s
|
||||
end
|
||||
|
||||
def to_str
|
||||
path.to_s
|
||||
end
|
||||
|
||||
def ==(path)
|
||||
to_str == path.to_str
|
||||
end
|
||||
|
||||
def eql?(path)
|
||||
to_str == path.to_str
|
||||
end
|
||||
# ==== </suck>
|
||||
alias to_path to_s
|
||||
|
||||
def find_templates(name, details, prefix, partial, root = "#{@path}/")
|
||||
if glob = details_to_glob(name, details, prefix, partial, root)
|
||||
|
@ -118,13 +102,16 @@ module ActionView
|
|||
|
||||
extensions = ""
|
||||
[:locales, :formats].each do |k|
|
||||
extensions << if exts = details[k]
|
||||
'{' + exts.map {|e| ".#{e},"}.join + '}'
|
||||
# TODO: OMG NO
|
||||
if details[k] == [:"*/*"]
|
||||
extensions << formats_glob if k == :formats
|
||||
elsif exts = details[k]
|
||||
extensions << '{' + exts.map {|e| ".#{e},"}.join + '}'
|
||||
else
|
||||
k == :formats ? formats_glob : ''
|
||||
extensions << formats_glob if k == :formats
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
"#{root}#{path}#{extensions}#{handler_glob}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -43,7 +43,7 @@ class ViewLoadPathsTest < ActionController::TestCase
|
|||
end
|
||||
|
||||
def expand(array)
|
||||
array.map {|x| File.expand_path(x)}
|
||||
array.map {|x| File.expand_path(x.to_s)}
|
||||
end
|
||||
|
||||
def assert_paths(*paths)
|
||||
|
|
|
@ -38,10 +38,13 @@ module ActionView #:nodoc:
|
|||
|
||||
extensions = ""
|
||||
[:locales, :formats].each do |k|
|
||||
extensions << if exts = details[k]
|
||||
'(?:' + exts.map {|e| "\\.#{Regexp.escape(e.to_s)}"}.join('|') + ')?'
|
||||
# TODO: OMG NO
|
||||
if details[k] == [:"*/*"]
|
||||
extensions << formats_regexp if k == :formats
|
||||
elsif exts = details[k]
|
||||
extensions << '(?:' + exts.map {|e| "\\.#{Regexp.escape(e.to_s)}"}.join('|') + ')?'
|
||||
else
|
||||
k == :formats ? formats_regexp : ''
|
||||
extensions << formats_regexp if k == :formats
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue