From a86eb98c1a3848d5e865b54e4ec22b0a4bf03924 Mon Sep 17 00:00:00 2001 From: Jason Schwarzenberger Date: Fri, 20 Nov 2020 13:06:19 +1300 Subject: [PATCH] fix hn self posts related discussion. --- apiserver/server.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apiserver/server.py b/apiserver/server.py index 3518e55..8b9cae0 100644 --- a/apiserver/server.py +++ b/apiserver/server.py @@ -99,8 +99,10 @@ def submit(): def story(sid): story = database.get_story(sid) if story: - related = database.get_stories_by_url(story.meta['url']) - related = [r.meta for r in related] + related = [] + if story.meta['url']: + related = database.get_stories_by_url(story.meta['url']) + related = [r.meta for r in related] res = Response(json.dumps({"story": story.data, "related": related})) res.headers['content-type'] = 'application/json' return res