From e2ea8d491b6ccc828a4379e62db0d3b5345affdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 15 Sep 2017 15:51:56 +0200 Subject: [PATCH] Added a bit of input validation --- pillar/web/nodes/finders.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pillar/web/nodes/finders.py b/pillar/web/nodes/finders.py index ee413b34..c83388ff 100644 --- a/pillar/web/nodes/finders.py +++ b/pillar/web/nodes/finders.py @@ -66,6 +66,9 @@ def find_for_comment(project, node): def find_for_post(project, node): """Returns the URL for a blog post.""" + if not node.properties: + raise ValueError(f'Node must have properties.url, but is {node}') + project_id = project['_id'] if str(project_id) == current_app.config['MAIN_PROJECT_ID']: return url_for('main.main_blog',