Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix to ensure image type is correctly extracted from content type (#…
…4062) * fix: modified extension.py to split file extension by ';' * test: added test that ensures that stripped file url is expected file type * test: added pytest cases for test_get_extension_from_content_type() * fix: added a . to one of the file extension parameters in pytest.mark.parametrize for test_get_extension_from_content_type() * Apply linting * Fix tests (initially) * fix: added check for the case of a semicolon in the content_type and modified get_file_extension_from_content_type() to utilize mimetypes.guess_extension() to automatically find file extensions in strings * fix: added check for test case for 'image/png;charset=UTF-8' * fix: changed jpeg to jpg * fix: changed test cases 'audio/midi' to compare to 'midi', and cases that return None when passed to mimetypes.guess_extension() to compare to None. Also, call mimetypes.guess_extension() in conditional header, assign it to variable, and then only strip it of '.' if it isn't None * fix: removed test input '5' because not iterable and added test input 'foobar' * Lint files --------- Co-authored-by: Darien <[email protected]> Co-authored-by: Madison Swain-Bowden <[email protected]>
- Loading branch information