catch newly thrown ValueErrors on get_file_parser

This commit is contained in:
Jfriedli 2021-03-23 21:20:54 +01:00
parent 501ecbf97e
commit c0d8d6c8eb
4 changed files with 48 additions and 42 deletions

View file

@ -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: