Fix regression in ActionDispatch::Routing::RouteSet#recognize_path

This commit is contained in:
Ole Friis Østergaard 2023-02-08 10:49:29 +00:00
parent e5522e9cc6
commit 1d3edd1c84
2 changed files with 2 additions and 1 deletions

@ -884,7 +884,7 @@ def call(env)
def recognize_path(path, environment = {})
method = (environment[:method] || "GET").to_s.upcase
path = Journey::Router::Utils.normalize_path(path) unless path.include?("://")
path = Journey::Router::Utils.normalize_path(path) unless path&.include?("://")
extras = environment[:extras] || {}
begin

@ -2129,6 +2129,7 @@ def test_recognize_path
assert_equal({ controller: "geocode", action: "show", postalcode: "12345" }, @routes.recognize_path("/extended/geocode/12345"))
assert_equal({ controller: "news", action: "index" }, @routes.recognize_path("/", method: :get))
assert_equal({ controller: "news", action: "index" }, @routes.recognize_path(nil))
assert_equal({ controller: "news", action: "index", format: "rss" }, @routes.recognize_path("/news.rss", method: :get))
assert_raise(ActionController::RoutingError) { @routes.recognize_path("/none", method: :get) }