-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* More liberal jpeg detection (Fixes #58) imghdr does not detect all jpeg files, let's accept any data starting with the JPEG SOI marker. See https://stackoverflow.com/questions/36870661/imghdr-python-cant-detec-type-of-some-images-image-extension for more details.
- Loading branch information
1 parent
00e3ef4
commit 019468e
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import pytest | ||
|
||
from mopidy_local import storage | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"data", | ||
[ | ||
pytest.param("ffd8ffe000104a46494600", id="JFIF"), | ||
pytest.param("ffd8ffe100184578696600", id="Exif"), | ||
pytest.param("ffd8ffe1095068747470", id="XMP"), | ||
], | ||
) | ||
def test_jpeg_detection(data): | ||
data_bytes = bytes.fromhex(data) | ||
assert storage.imghdr.what(None, data_bytes) is not None |