From a994d37a9e8ab226862079fa0286c9eaeaeb737b Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Fri, 19 Jun 2015 21:52:06 +0000 Subject: [PATCH] Protocol agnostic URL for emoticons --- rophako/model/emoticons.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rophako/model/emoticons.py b/rophako/model/emoticons.py index 68344e5..1216028 100644 --- a/rophako/model/emoticons.py +++ b/rophako/model/emoticons.py @@ -70,8 +70,11 @@ def render(message): for trigger in smileys["map"][img]: if trigger in message: # Substitute it. + url = request.url_root.strip("/") \ + .replace("http:", "") \ + .replace("https:", "") sub = """{trigger}""".format( - url="{}/static/smileys/{}/{}".format(request.url_root.strip("/"), Config.emoticons.theme, img), + url="{}/static/smileys/{}/{}".format(url, Config.emoticons.theme, img), trigger=trigger, ) pattern = r'([^A-Za-z0-9:\-]|^){}([^A-Za-z0-9:\-]|$)'.format(re.escape(trigger))