From cd49dce78f267a6a33ec9d82258f5f712eda9ea0 Mon Sep 17 00:00:00 2001 From: Samuel FORESTIER Date: Fri, 25 Jan 2019 11:00:57 +0100 Subject: [PATCH] [PATCH v2] Removes potential '//' from email links (#420, #519, #523) --- isso/ext/notifications.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/isso/ext/notifications.py b/isso/ext/notifications.py index 0743b6b..692894a 100644 --- a/isso/ext/notifications.py +++ b/isso/ext/notifications.py @@ -76,7 +76,14 @@ class SMTP(object): self.isso = isso self.conf = isso.conf.section("smtp") - self.public_endpoint = isso.conf.get("server", "public-endpoint") or local("host") + self.public_endpoint = isso.conf.get("server", "public-endpoint") + # rstrips potential trailing '/', without having to `repr` the `local` object. + if self.public_endpoint: + if self.public_endpoint.endswith('/'): + self.public_endpoint = self.public_endpoint.rstrip('/') + else: + self.public_endpoint = local("host") + self.admin_notify = any((n in ("smtp", "SMTP")) for n in isso.conf.getlist("general", "notify")) self.reply_notify = isso.conf.getboolean("general", "reply-notifications")