mirror of
https://0xacab.org/jvoisin/mat2-web.git
synced 2025-06-24 14:20:34 -04:00
Improve the display of supported formats
- Show the extension instead of the mimetype - Sort the results
This commit is contained in:
parent
769bafac0a
commit
457d171cd4
2 changed files with 6 additions and 3 deletions
5
main.py
5
main.py
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
import hashlib
|
||||
import hmac
|
||||
import mimetypes as mtype
|
||||
|
||||
from libmat2 import parser_factory
|
||||
|
||||
|
@ -60,7 +61,9 @@ def upload_file():
|
|||
|
||||
mimetypes = set()
|
||||
for parser in parser_factory._get_parsers():
|
||||
mimetypes = mimetypes | parser.mimetypes
|
||||
mimetypes |= set(map(mtype.guess_extension, parser.mimetypes))
|
||||
# since `guess_extension` might return `None`, we need to filter it out
|
||||
mimetypes = sorted(filter(None, mimetypes))
|
||||
|
||||
if request.method == 'POST':
|
||||
if 'file' not in request.files: # check if the post request has the file part
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue