Fix infinite redirect for 'subscription_ajax'

This commit is contained in:
Omar Roth 2018-08-06 19:51:37 -05:00
parent 4d034bedce
commit d2d5de55c1

View file

@ -1051,7 +1051,10 @@ end
get "/subscription_ajax" do |env| get "/subscription_ajax" do |env|
user = env.get? "user" user = env.get? "user"
referer = env.request.headers["referer"]? referer = env.request.headers["referer"]?
referer ||= "/"
if !referer || URI.parse(referer).path.try &.== "/subscription_ajax"
referer = "/"
end
if user if user
user = user.as(User) user = user.as(User)