From 1cb57401b62a495716e963c7e7306de3897bc93a Mon Sep 17 00:00:00 2001 From: Zed Date: Mon, 1 Jun 2020 05:31:11 +0200 Subject: [PATCH] Ignore trailing slashes for list routes --- src/routes/list.nim | 4 ++-- src/routes/unsupported.nim | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/routes/list.nim b/src/routes/list.nim index 0cd0660..05775f7 100644 --- a/src/routes/list.nim +++ b/src/routes/list.nim @@ -19,7 +19,7 @@ template respList*(list, timeline, vnode: typed) = proc createListRouter*(cfg: Config) = router list: - get "/@name/lists/@list": + get "/@name/lists/@list/?": cond '.' notin @"name" cond @"name" != "i" let @@ -36,7 +36,7 @@ proc createListRouter*(cfg: Config) = members = await getListMembers(list) respList(list, members, renderTimelineUsers(members, cookiePrefs(), request.path)) - get "/i/lists/@id": + get "/i/lists/@id/?": cond '.' notin @"id" let list = await getCachedList(id=(@"id")) if list.id.len == 0: diff --git a/src/routes/unsupported.nim b/src/routes/unsupported.nim index ddaf9d4..28e8b8a 100644 --- a/src/routes/unsupported.nim +++ b/src/routes/unsupported.nim @@ -6,15 +6,14 @@ import ../views/[general, about] proc createUnsupportedRouter*(cfg: Config) = router unsupported: - get "/about/feature": + template feature {.dirty.} = resp renderMain(renderFeature(), request, cfg) - get "/intent/?@i?": - resp renderMain(renderFeature(), request, cfg) - - get "/login/?@i?": - resp renderMain(renderFeature(), request, cfg) + get "/about/feature": feature() + get "/intent/?@i?": feature() + get "/login/?@i?": feature() + get "/@name/lists/?": feature() get "/i/@i?/?@j?": cond @"i" notin ["status", "lists"] - resp renderMain(renderFeature(), request, cfg) + feature()