From d2d5de55c158f52c8bc71fc5f2db055c3b86e66c Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Mon, 6 Aug 2018 19:51:37 -0500 Subject: [PATCH] Fix infinite redirect for 'subscription_ajax' --- src/invidious.cr | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/invidious.cr b/src/invidious.cr index defd3254..8a3b8ae3 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -1051,7 +1051,10 @@ end get "/subscription_ajax" do |env| user = env.get? "user" referer = env.request.headers["referer"]? - referer ||= "/" + + if !referer || URI.parse(referer).path.try &.== "/subscription_ajax" + referer = "/" + end if user user = user.as(User)