From 94e4cce1f23ddf6c1813f44238576f8d74d95d24 Mon Sep 17 00:00:00 2001 From: Roland Date: Wed, 14 Dec 2022 19:14:19 -0700 Subject: [PATCH] Special handling for csv mimetype files. --- wrolpi/files/lib.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/wrolpi/files/lib.py b/wrolpi/files/lib.py index 38a11b15..5a9426a1 100644 --- a/wrolpi/files/lib.py +++ b/wrolpi/files/lib.py @@ -101,10 +101,13 @@ def _mimetype_suffix_map(path: Path, mimetype: str): suffix = path.suffix.lower() if mimetype == 'application/octet-stream' and suffix.endswith('.mobi'): return MOBI_MIMETYPE - if mimetype == 'text/plain' and suffix.endswith('.json'): - return 'application/json' - if mimetype == 'text/plain' and suffix.endswith('.vtt'): - return 'text/vtt' + if mimetype == 'text/plain': + if suffix.endswith('.json'): + return 'application/json' + if suffix.endswith('.vtt'): + return 'text/vtt' + if suffix.endswith('.csv'): + return 'text/csv' return mimetype