From 35f31357427fac7f059ef95b809fceb3c49ad004 Mon Sep 17 00:00:00 2001 From: Deimos Date: Tue, 14 Jan 2020 09:45:49 -0700 Subject: [PATCH] Trim leading/trailing whitespace on topic links --- tildes/tildes/schemas/topic.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tildes/tildes/schemas/topic.py b/tildes/tildes/schemas/topic.py index 10c5bde..017d057 100644 --- a/tildes/tildes/schemas/topic.py +++ b/tildes/tildes/schemas/topic.py @@ -113,8 +113,11 @@ class TopicSchema(Schema): if "link" not in data: return data + # remove leading/trailing whitespace + data["link"] = data["link"].strip() + # if the value is empty, convert it to None - if not data["link"] or data["link"].isspace(): + if not data["link"]: data["link"] = None return data