From 1bd48ea8ca909e4f3e15171330f1b989b6e4e243 Mon Sep 17 00:00:00 2001 From: Zed Date: Sat, 2 May 2020 19:23:47 +0200 Subject: [PATCH] Fix timeline double requests due to templates This one is a bit embarrassing.. --- src/routes/resolver.nim | 5 +++-- src/routes/timeline.nim | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/routes/resolver.nim b/src/routes/resolver.nim index 3d2ac5d..0a215a2 100644 --- a/src/routes/resolver.nim +++ b/src/routes/resolver.nim @@ -7,10 +7,11 @@ import ".."/[query, types, api, agents] import ../views/general template respResolved*(url, kind: string): untyped = - if url.len == 0: + let u = url + if u.len == 0: resp showError("Invalid $1 link" % kind, cfg) else: - redirect(url) + redirect(u) proc createResolverRouter*(cfg: Config) = router resolver: diff --git a/src/routes/timeline.nim b/src/routes/timeline.nim index 072d87f..b89908a 100644 --- a/src/routes/timeline.nim +++ b/src/routes/timeline.nim @@ -78,9 +78,10 @@ proc showTimeline*(request: Request; query: Query; cfg: Config; prefs: Prefs; rss=rss, images = @[p.getUserpic("_200x200")]) template respTimeline*(timeline: typed) = - if timeline.len == 0: + let t = timeline + if t.len == 0: resp Http404, showError("User \"" & @"name" & "\" not found", cfg) - resp timeline + resp t proc createTimelineRouter*(cfg: Config) = setProfileCacheTime(cfg.profileCacheTime)