neddit

the frontend of the frontpage of the internet  https://neddit.ce9e.org
git clone https://git.ce9e.org/neddit.git

commit
a2db7a3ac2706973a9153ad809b51dd47fc0e915
parent
6843ae1a6d3427696c2e66858a97799d9318284c
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-01-03 21:38
redirect on missing trailing slash

Diffstat

M neddit.py 5 ++++-

1 files changed, 4 insertions, 1 deletions


diff --git a/neddit.py b/neddit.py

@@ -93,6 +93,9 @@ async def fetch_subreddit(name):
   93    93 
   94    94 
   95    95 async def generic(request):
   -1    96     if not request.path.endswith('/'):
   -1    97         raise web.HTTPPermanentRedirect(f'{request.raw_path}/')
   -1    98 
   96    99     path = request.path.strip('/') or 'hot'
   97   100     context = {
   98   101         'params': request.query,
@@ -122,5 +125,5 @@ if __name__ == '__main__':
  122   125     app = web.Application()
  123   126     app.router.add_static('/static', BASE_DIR / 'static')
  124   127     app.router.add_route('GET', '', generic)
  125    -1     app.router.add_route('GET', '/{path:.*}/', generic)
   -1   128     app.router.add_route('GET', '/{path:.*}', generic)
  126   129     web.run_app(app, host='localhost', port=args.port)