Always fetching mimetype. Special handling for .stl files.

This commit is contained in:
Roland 2022-12-14 19:25:05 -07:00
parent 94e4cce1f2
commit f7aaa1363c
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
2 changed files with 5 additions and 2 deletions

View file

@ -813,8 +813,7 @@ def apply_modelers(files, session: Session):
# Group all files by their common name (without the suffix).
groups = {}
for file in files:
if not file.mimetype:
file.mimetype = get_mimetype(file.path)
file.mimetype = get_mimetype(file.path)
stem, _ = split_path_stem_and_suffix(file.path)
try:
groups[stem].append(file)

View file

@ -108,6 +108,10 @@ def _mimetype_suffix_map(path: Path, mimetype: str):
return 'text/vtt'
if suffix.endswith('.csv'):
return 'text/csv'
if suffix.endswith('.html') or suffix.endswith('.htm'):
return 'text/html'
if suffix.endswith('.stl'):
return 'application/sta'
return mimetype