Creating special exception for applicatoni/x-subrip mimetype.

This commit is contained in:
Roland 2023-08-30 15:05:43 -06:00
parent d3074eb3d8
commit 1b4d4d7ad5
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
2 changed files with 5 additions and 2 deletions

View file

@ -220,6 +220,9 @@ def _mimetype_suffix_map(path: Path, mimetype: str):
return 'application/vnd.amazon.mobi8-ebook'
if suffix.endswith('.obj'):
return 'model/obj'
if mimetype == 'application/x-subrip':
# Fallback to old mimetype.
return 'text/srt'
return mimetype

View file

@ -183,7 +183,7 @@ async def test__upsert_files(test_session, make_files_structure, test_directory,
assert_file_groups([
{'primary_path': video_file, 'idempotency': idempotency, 'modification_datetime': foo_mtime, 'indexed': False,
'files': [
{'path': srt_file3, 'size': 951, 'suffix': '.en.srt', 'mimetype': 'application/x-subrip'},
{'path': srt_file3, 'size': 951, 'suffix': '.en.srt', 'mimetype': 'text/srt'},
{'path': video_file, 'size': 1056318, 'suffix': '.mp4', 'mimetype': 'video/mp4'},
]},
{'primary_path': bar, 'idempotency': idempotency, 'indexed': False,
@ -210,7 +210,7 @@ async def test__upsert_files(test_session, make_files_structure, test_directory,
assert_file_groups([
{'primary_path': video_file, 'idempotency': idempotency, 'modification_datetime': foo_mtime, 'indexed': True,
'files': [
{'path': srt_file3, 'size': 951, 'suffix': '.en.srt', 'mimetype': 'application/x-subrip'},
{'path': srt_file3, 'size': 951, 'suffix': '.en.srt', 'mimetype': 'text/srt'},
{'path': video_file, 'size': 1056318, 'suffix': '.mp4', 'mimetype': 'video/mp4'},
]},
{'primary_path': bar, 'idempotency': idempotency, 'indexed': False,