Ensure multiple leading / are also removed, thanks @homakov
This commit is contained in:
parent
3b598ec235
commit
f36efc0cc9
|
@ -33,7 +33,7 @@ module Devise
|
|||
#
|
||||
def store_location_for(resource_or_scope, location)
|
||||
session_key = stored_location_key_for(resource_or_scope)
|
||||
session[session_key] = URI.parse(location).path if location
|
||||
session[session_key] = URI.parse(location).path.sub(/\A\/+/, '/') if location
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -199,9 +199,10 @@ class ControllerAuthenticatableTest < ActionController::TestCase
|
|||
end
|
||||
|
||||
test 'store location for stores only paths' do
|
||||
assert_nil @controller.stored_location_for(:user)
|
||||
@controller.store_location_for(:user, "//host/foo.bar")
|
||||
assert_equal "/foo.bar", @controller.stored_location_for(:user)
|
||||
@controller.store_location_for(:user, "///foo.bar")
|
||||
assert_equal "/foo.bar", @controller.stored_location_for(:user)
|
||||
end
|
||||
|
||||
test 'after sign in path defaults to root path if none by was specified for the given scope' do
|
||||
|
|
Loading…
Reference in New Issue