From 3bfe51a60f80a4de823c8365cd94c443dd924810 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Sun, 17 Sep 2023 14:49:20 +0200 Subject: [PATCH] Routes: Run 'before_all' handler in case of a 404 --- src/invidious/routes/errors.cr | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/invidious/routes/errors.cr b/src/invidious/routes/errors.cr index f6b94df3..d0622621 100644 --- a/src/invidious/routes/errors.cr +++ b/src/invidious/routes/errors.cr @@ -1,5 +1,11 @@ module Invidious::Routes::ErrorRoutes def self.error_404(env) + # Try to fetch user account/preferences and add CSP headers + begin + BeforeAll.handle(env) + rescue ex + end + # Workaround for #3117 if HOST_URL.empty? && env.request.path.starts_with?("/v1/storyboards/sb") return env.redirect "#{env.request.path[15..]}?#{env.params.query}"