Skip to content

Commit

Permalink
Merge branch 'hotfixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
emillon committed Dec 15, 2014
2 parents 54151fb + f5a67f2 commit b19f2c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from flask import url_for
from flask.ext.login import current_user
from flask.ext.login import login_required
from flask.ext.uploads import UploadNotAllowed
from flask.ext.wtf import Form
from flask_wtf.file import FileField
from werkzeug.exceptions import BadRequest
Expand Down Expand Up @@ -88,7 +89,11 @@ def upload():
"""
form = UploadForm()
if form.validate_on_submit():
filename = documents.save(form.file.data)
try:
filename = documents.save(form.file.data)
except UploadNotAllowed:
flash('Unsupported file type')
return redirect(url_for('.home'))
doc = Document(filename)
db.session.add(doc)
db.session.commit()
Expand Down
2 changes: 1 addition & 1 deletion templates/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ <h3><span class="glyphicon glyphicon-comment"></span> Comments</h3>
upload_form_init();
PDFJS.workerSrc = "{{url_for('static', filename='vendor/pdfjs-' + config.X_PDFJS_VERSION + '-dist/build/pdf.worker.js')}}";
view_init({{doc.id}}, "{{doc.filetype}}", {{js_bool(readOnly)}});
}
});
</script>
{% endblock %}

0 comments on commit b19f2c7

Please sign in to comment.