invidious icon indicating copy to clipboard operation
invidious copied to clipboard

Routes: use 'resolve_url()' in 404 error route

Open SamantazFox opened this issue 1 year ago • 3 comments

Closes #3933

TODO: also use resolve_url for channel search

SamantazFox avatar Jul 16 '23 16:07 SamantazFox

I'll probably add a nice 404 graphic in a future PR

SamantazFox avatar Sep 16 '23 22:09 SamantazFox

It looks like the before_all handler isn't called for the error routes so important data like user preferences aren't loaded.

server error

2023-09-16T22:55:43.137314Z  ERROR - http.server: Unhandled exception on HTTP::Handler
Missing hash key: "preferences" (KeyError)
  from /usr/lib/crystal/hash.cr:1077:11 in '[]'
  from lib/kemal/src/kemal/ext/context.cr:51:7 in 'get'
  from src/invidious/views/template.ecr:2:17 in 'error_404'
  from src/invidious.cr:203:3 in '->'
  from lib/kemal/src/kemal/config.cr:96:102 in '->'
  from src/invidious/helpers/handlers.cr:57:71 in 'call_exception_with_status_code'
  from lib/kemal/src/kemal/exception_handler.cr:10:7 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/invidious/helpers/logger.cr:17:35 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from lib/kemal/src/kemal/init_handler.cr:12:7 in 'call'
  from /usr/lib/crystal/http/server/request_processor.cr:51:11 in 'process'
  from /usr/lib/crystal/http/server.cr:521:5 in 'handle_client'
  from /usr/lib/crystal/http/server.cr:451:5 in '->'
  from /usr/lib/crystal/fiber.cr:146:11 in 'run'
  from /usr/lib/crystal/fiber.cr:98:34 in '->'
  from ???

syeopite avatar Sep 16 '23 23:09 syeopite

We might want to use a list of allowed params, to avoid that sort of stuff:

image

Source: https://beach.city/@vantablack/111104436896607330

SamantazFox avatar Sep 23 '23 10:09 SamantazFox