Allow all /my URLs
Previously, URLs like /my/activity/posts were denied. This change allows those URLs.
This commit is contained in:
parent
6f8888d405
commit
6e698315d6
|
@ -81,7 +81,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def my_redirect
|
||||
if current_user.present? && params[:path] =~ /^[a-z\-]+$/
|
||||
if current_user.present? && params[:path] =~ /^[a-z\-\/]+$/
|
||||
redirect_to "/users/#{current_user.username}/#{params[:path]}"
|
||||
return
|
||||
end
|
||||
|
|
|
@ -185,7 +185,7 @@ Discourse::Application.routes.draw do
|
|||
get "users/activate-account/:token" => "users#activate_account"
|
||||
get "users/authorize-email/:token" => "users#authorize_email"
|
||||
get "users/hp" => "users#get_honeypot_value"
|
||||
get "my/:path", to: 'users#my_redirect'
|
||||
get "my/*path", to: 'users#my_redirect'
|
||||
|
||||
get "user_preferences" => "users#user_preferences_redirect"
|
||||
get "users/:username/private-messages" => "user_actions#private_messages", constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
|
|
|
@ -1330,6 +1330,11 @@ describe UsersController do
|
|||
get :my_redirect, path: "preferences"
|
||||
response.should be_redirect
|
||||
end
|
||||
|
||||
it "permits forward slashes" do
|
||||
get :my_redirect, path: "activity/posts"
|
||||
response.should be_redirect
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue