mirror of
https://0xacab.org/jvoisin/mat2-web.git
synced 2025-06-27 15:47:24 -04:00
catch newly thrown ValueErrors on get_file_parser
This commit is contained in:
parent
501ecbf97e
commit
c0d8d6c8eb
4 changed files with 48 additions and 42 deletions
|
@ -64,11 +64,11 @@ def upload_file():
|
|||
current_app.logger.error('Invalid Filename in upload')
|
||||
return redirect(request.url)
|
||||
|
||||
parser, mime = utils.get_file_parser(filepath)
|
||||
|
||||
if parser is None:
|
||||
flash('The type %s is not supported' % mime)
|
||||
current_app.logger.error('Unsupported type %s', mime)
|
||||
try:
|
||||
parser, mime = utils.get_file_parser(filepath)
|
||||
except ValueError:
|
||||
flash('The filetype is not supported')
|
||||
current_app.logger.error('Unsupported filetype',)
|
||||
return redirect(url_for('routes.upload_file'))
|
||||
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue