Skip to content

Commit fbabe31

Browse files
committed
use filetypes mimetype instead of constructing mimetype with extension
1 parent 6b9f40c commit fbabe31

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bash_kernel/display.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ def display_data_for_image(filename):
102102
with open(filename, 'rb') as f:
103103
image = f.read()
104104
_unlink_if_temporary(filename)
105-
image_type = filetype.image_match(image).extension
106-
if image_type not in ("png", "jpg", "gif", "webp"):
105+
image_type = filetype.image_match(image).mime
106+
if image_type not in ("image/png", "image/jpg", "image/gif", "image/webp"):
107107
raise ValueError("Not a valid image: %s" % image)
108108

109109
content = {
110110
'data': {
111-
'image/' + image_type: image
111+
image_type: image
112112
},
113113
'metadata': {}
114114
}

0 commit comments

Comments
 (0)