aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2018-08-23 20:01:30 +0930
committerMatthew Draper <matthew@trebex.net>2018-08-23 20:01:30 +0930
commiteb68fec314322fc3d06baa3da1e41fc59efb4fa6 (patch)
tree04d0c32d4e868531970f00ae664f7fde3d97cedb
parent047a893da7a43b8e115b854c73735b9e6475838e (diff)
downloadrails-eb68fec314322fc3d06baa3da1e41fc59efb4fa6.tar.gz
rails-eb68fec314322fc3d06baa3da1e41fc59efb4fa6.tar.bz2
rails-eb68fec314322fc3d06baa3da1e41fc59efb4fa6.zip
Use string lengths instead of regexp to extract path
The regexp was introduced in 186ac4cdaa911a9af659a29f2179a19b99dea13b, and looks cosmetic. While they should be functionally identical in theory, in practice, case insensitive (but preserving) filesystems can give results that are differently-cased from the pattern we supplied. I don't know how to force the filesystem to do the surprising thing, even when running in an environment that _could_, so no new test.
-rw-r--r--actionpack/lib/action_controller/metal/helpers.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal/helpers.rb b/actionpack/lib/action_controller/metal/helpers.rb
index 22c84e440b..0faaac1ce4 100644
--- a/actionpack/lib/action_controller/metal/helpers.rb
+++ b/actionpack/lib/action_controller/metal/helpers.rb
@@ -100,8 +100,7 @@ module ActionController
# # => ["application", "chart", "rubygems"]
def all_helpers_from_path(path)
helpers = Array(path).flat_map do |_path|
- extract = /^#{Regexp.quote(_path.to_s)}\/?(.*)_helper.rb$/
- names = Dir["#{_path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1'.freeze) }
+ names = Dir["#{_path}/**/*_helper.rb"].map { |file| file[_path.to_s.size + 1..-"_helper.rb".size - 1] }
names.sort!
end
helpers.uniq!