Merge branch 'master' of github.com:vurpo/telematrix

This commit is contained in:
Max Sandholm 2017-09-21 13:31:33 +02:00
commit 2ee824f4ca
2 changed files with 31 additions and 26 deletions

3
.gitignore vendored
View File

@ -122,6 +122,9 @@ Session.vim
tags
#VSCode
.vscode
### macOS ###
*.DS_Store
.AppleDouble

View File

@ -12,6 +12,7 @@ from datetime import datetime
from time import time
from urllib.parse import unquote, quote, urlparse, parse_qs
from io import BytesIO
import re
from PIL import Image
from aiohttp import web, ClientSession
@ -96,6 +97,7 @@ def format_matrix_msg(form, content):
:return: The formatted string.
"""
if 'format' in content and content['format'] == 'org.matrix.custom.html':
re.sub("<a href=\"https://matrix.to/#/@telegram_([0-9]+):{}\">(.+?)</a>".format(MATRIX_HOST_BARE), "<a href=\"tg://user?id=\\1\">\\2</a>", content['formatted_body'])
sanitized = sanitize_html(content['formatted_body'])
return html.escape(form).format(sanitized), 'HTML'
else: