Skip to content

Commit

Permalink
refactor: add better link presence checking
Browse files Browse the repository at this point in the history
  • Loading branch information
unlxam committed Aug 25, 2024
1 parent 742ca2d commit 60a3bef
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/invidious/routes/misc.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 60a3bef

Please sign in to comment.