|
@@ -13,6 +13,7 @@ from bottle import (
|
|
|
template, static_file,
|
|
|
HTTPResponse,
|
|
|
)
|
|
|
+from itertools import chain
|
|
|
from base64 import urlsafe_b64decode as b64decode
|
|
|
from linkpreview import link_preview
|
|
|
|
|
@@ -101,7 +102,12 @@ LIMIT 1;
|
|
|
con.close()
|
|
|
|
|
|
|
|
|
- content = content.split(';')[-1]
|
|
|
+ _, mime, encoding, content = chain.from_iterable(map(
|
|
|
+ lambda x: x.split(','), chain.from_iterable(map(
|
|
|
+ lambda x: x.split(';'), content.split(':')
|
|
|
+ ))
|
|
|
+ ))
|
|
|
+ assert encoding == 'base64', f'unsupported encoding: {encoding}'
|
|
|
content = b64decode(content + '==')
|
|
|
|
|
|
if request.params.download == "false":
|