summaryrefslogtreecommitdiff
path: root/matweb/frontend.py
diff options
context:
space:
mode:
Diffstat (limited to 'matweb/frontend.py')
-rw-r--r--matweb/frontend.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/matweb/frontend.py b/matweb/frontend.py
index 48e4c19..7a3037d 100644
--- a/matweb/frontend.py
+++ b/matweb/frontend.py
@@ -71,22 +71,23 @@ def upload_file():
71 current_app.logger.error('Unsupported type %s', mime) 71 current_app.logger.error('Unsupported type %s', mime)
72 return redirect(url_for('routes.upload_file')) 72 return redirect(url_for('routes.upload_file'))
73 73
74 meta = parser.get_meta() 74 try:
75 75 if parser.remove_all() is not True:
76 if parser.remove_all() is not True: 76 flash('Unable to clean %s' % mime)
77 flash('Unable to clean %s' % mime) 77 current_app.logger.error('Unable to clean %s', mime)
78 current_app.logger.error('Unable to clean %s', mime) 78 return redirect(url_for('routes.upload_file'))
79 return redirect(url_for('routes.upload_file')) 79 meta = parser.get_meta()
80 80 key, secret, meta_after, output_filename = utils.cleanup(parser, filepath, current_app.config['UPLOAD_FOLDER'])
81 key, secret, meta_after, output_filename = utils.cleanup(parser, filepath, current_app.config['UPLOAD_FOLDER'])
82 81
83 return render_template( 82 return render_template(
84 'download.html', 83 'download.html',
85 mimetypes=mime_types, 84 mimetypes=mime_types,
86 meta=meta, 85 meta=meta,
87 download_uri=url_for('routes.download_file', key=key, secret=secret, filename=output_filename), 86 download_uri=url_for('routes.download_file', key=key, secret=secret, filename=output_filename),
88 meta_after=meta_after, 87 meta_after=meta_after,
89 ) 88 )
89 except (RuntimeError, ValueError):
90 flash('The type %s could no be cleaned' % mime)
90 91
91 max_file_size = int(current_app.config['MAX_CONTENT_LENGTH'] / 1024 / 1024) 92 max_file_size = int(current_app.config['MAX_CONTENT_LENGTH'] / 1024 / 1024)
92 return render_template('index.html', max_file_size=max_file_size, mimetypes=mime_types) \ No newline at end of file 93 return render_template('index.html', max_file_size=max_file_size, mimetypes=mime_types) \ No newline at end of file