Skip to content

Commit 505a909

Browse files
committed
fix svg display error
1 parent e360996 commit 505a909

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

django-mdict.conf

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<IfModule expires_module>
22
#设置浏览器端缓存
33
ExpiresActive on
4-
#缓存时长7200000/3600/24=83天
5-
ExpiresByType text/css A7200000
6-
ExpiresByType application/x-javascript A7200000
7-
ExpiresByType application/javascript A7200000
8-
ExpiresByType text/plain A7200000
9-
#ExpiresByType text/html A7200000
10-
ExpiresByType image/jpeg A7200000
11-
ExpiresByType image/gif A7200000
12-
ExpiresByType image/png A7200000
13-
ExpiresByType image/x-icon A7200000
14-
ExpiresByType font/ttf A7200000
15-
ExpiresByType font/woff A7200000
4+
#缓存时长604800/3600/24=7天
5+
ExpiresByType text/css A604800
6+
ExpiresByType application/x-javascript A604800
7+
ExpiresByType application/javascript A604800
8+
ExpiresByType text/plain A604800
9+
ExpiresByType image/jpeg A604800
10+
ExpiresByType image/gif A604800
11+
ExpiresByType image/png A604800
12+
ExpiresByType image/x-icon A604800
13+
ExpiresByType font/ttf A2592000
14+
ExpiresByType font/woff A2592000
15+
ExpiresByType font/woff2 A2592000
1616
</IfModule>
1717
WSGIApplicationGroup %{GLOBAL}
1818
WSGIPassAuthorization On

mdict/mdict_utils/search_object.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ def search_mdd(self):
260260

261261
if mime_type.startswith('image/'):
262262
# 判断图片真实类型
263-
mime_type = 'image/' + imghdr.what(None, res_content)
263+
img_type = imghdr.what(None, res_content)
264+
if img_type is not None:
265+
mime_type = 'image/' + img_type
264266

265267
if mime_type == 'image/tiff':
266268
im = Image.open(BytesIO(res_content))

0 commit comments

Comments
 (0)