Absolute URL for emoticons

This commit is contained in:
Noah 2014-12-16 20:26:01 +00:00
parent 7184d9ad3c
commit 364c334b98

View File

@ -2,6 +2,7 @@
"""Emoticon models.""" """Emoticon models."""
from flask import request
import os import os
import codecs import codecs
import json import json
@ -69,7 +70,7 @@ def render(message):
if trigger in message: if trigger in message:
# Substitute it. # Substitute it.
sub = """<img src="{url}" class="rophako-emoticon" alt="{trigger}" title="{trigger}">""".format( sub = """<img src="{url}" class="rophako-emoticon" alt="{trigger}" title="{trigger}">""".format(
url="/static/smileys/{}/{}".format(Config.emoticons.theme, img), url="{}/static/smileys/{}/{}".format(request.url_root.strip("/"), Config.emoticons.theme, img),
trigger=trigger, trigger=trigger,
) )
pattern = r'([^A-Za-z0-9:\-]|^){}([^A-Za-z0-9:\-]|$)'.format(re.escape(trigger)) pattern = r'([^A-Za-z0-9:\-]|^){}([^A-Za-z0-9:\-]|$)'.format(re.escape(trigger))