Add redirect for legacy '/profile' endpoint

This commit is contained in:
Omar Roth 2019-01-23 23:12:48 -06:00
parent 30f08ae48c
commit 0fcfb7b82b

View file

@ -2142,6 +2142,16 @@ get "/c/:user" do |env|
env.redirect anchor["href"] env.redirect anchor["href"]
end end
# Legacy endpoint for /user/:username
get "/profile" do |env|
user = env.params.query["user"]?
if !user
env.redirect "/"
else
env.redirect "/user/#{user}"
end
end
get "/user/:user" do |env| get "/user/:user" do |env|
user = env.params.url["user"] user = env.params.url["user"]
env.redirect "/channel/#{user}" env.redirect "/channel/#{user}"