diff options
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 |
