Routes: Run 'before_all' handler in case of a 404

This commit is contained in:
Samantaz Fox 2023-09-17 14:49:20 +02:00
parent 72d2817c36
commit 9b40600835
No known key found for this signature in database
GPG Key ID: F42821059186176E
1 changed files with 6 additions and 0 deletions

View File

@ -1,5 +1,11 @@
module Invidious::Routes::ErrorRoutes module Invidious::Routes::ErrorRoutes
def self.error_404(env) 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 # Workaround for #3117
if HOST_URL.empty? && env.request.path.starts_with?("/v1/storyboards/sb") if HOST_URL.empty? && env.request.path.starts_with?("/v1/storyboards/sb")
return env.redirect "#{env.request.path[15..]}?#{env.params.query}" return env.redirect "#{env.request.path[15..]}?#{env.params.query}"