From 307e6f56863690ba9cd0c47d109ac8bf6cfbcf9b Mon Sep 17 00:00:00 2001 From: unlxam <177877261+unlxam@users.noreply.github.com> Date: Sun, 25 Aug 2024 15:24:05 -0300 Subject: [PATCH] refactor: add better link presence checking --- src/invidious/routes/misc.cr | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/invidious/routes/misc.cr b/src/invidious/routes/misc.cr index c0bef5b4..ff863f58 100644 --- a/src/invidious/routes/misc.cr +++ b/src/invidious/routes/misc.cr @@ -46,17 +46,14 @@ module Invidious::Routes::Misc def self.confirm_leave(env) locale = env.get("preferences").as(Preferences).locale - - link = env.params.query["link"]? - link = HTML.escape(link.to_s) - referer = get_referer(env) - if link && !link.empty? + if env.params.query["link"]? && !env.params.query["link"].empty? + link = HTML.escape(env.params.query["link"].to_s) + templated "confirm_leave" else env.redirect "#{referer}" end - end end