update translations

This commit is contained in:
idalin
2017-02-23 13:52:58 +08:00
parent 9020c35819
commit 3dcfebca60
3 changed files with 38 additions and 24 deletions

View File

@ -51,6 +51,7 @@ except ImportError, e:
use_generic_pdf_cover = True
from cgi import escape
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'epub', 'mobi', 'azw', 'azw3', 'cbr', 'cbz', 'cbt', 'djvu', 'prc', 'doc', 'docx', 'fb2'])
# Proxy Helper class
class ReverseProxied(object):
@ -2136,6 +2137,19 @@ def upload():
db.session.connection().connection.connection.create_function('uuid4', 0, lambda: str(uuid4()))
if request.method == 'POST' and 'btn-upload' in request.files:
file = request.files['btn-upload']
file = request.files['btn-upload']
if '.' in file.filename:
file_ext = file.filename.rsplit('.', 1)[-1].lower()
if file_ext not in ALLOWED_EXTENSIONS:
flash(
_('File extension "%s" is not allowed to be uploaded to this server' %
file_ext),
category="error"
)
return redirect(url_for('index'))
else:
flash(_('File to be uploaded must have an extension'), category="error")
return redirect(url_for('index'))
meta = uploader.upload(file)
title = meta.title