diff options
| author | jvoisin | 2019-03-06 21:20:39 +0100 |
|---|---|---|
| committer | jvoisin | 2019-03-06 21:25:06 +0100 |
| commit | 457d171cd48bf4809d3809fc9511836795972bf5 (patch) | |
| tree | 1469ba539371703008abc659c0af87dd215e9930 /main.py | |
| parent | 769bafac0acdf3e0b41f42a60df1029d6e0e3829 (diff) | |
Improve the display of supported formats
- Show the extension instead of the mimetype
- Sort the results
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 5 |
1 files changed, 4 insertions, 1 deletions
| @@ -1,6 +1,7 @@ | |||
| 1 | import os | 1 | import os |
| 2 | import hashlib | 2 | import hashlib |
| 3 | import hmac | 3 | import hmac |
| 4 | import mimetypes as mtype | ||
| 4 | 5 | ||
| 5 | from libmat2 import parser_factory | 6 | from libmat2 import parser_factory |
| 6 | 7 | ||
| @@ -60,7 +61,9 @@ def upload_file(): | |||
| 60 | 61 | ||
| 61 | mimetypes = set() | 62 | mimetypes = set() |
| 62 | for parser in parser_factory._get_parsers(): | 63 | for parser in parser_factory._get_parsers(): |
| 63 | mimetypes = mimetypes | parser.mimetypes | 64 | mimetypes |= set(map(mtype.guess_extension, parser.mimetypes)) |
| 65 | # since `guess_extension` might return `None`, we need to filter it out | ||
| 66 | mimetypes = sorted(filter(None, mimetypes)) | ||
| 64 | 67 | ||
| 65 | if request.method == 'POST': | 68 | if request.method == 'POST': |
| 66 | if 'file' not in request.files: # check if the post request has the file part | 69 | if 'file' not in request.files: # check if the post request has the file part |
