修复base64图片上传接口的图片格式验证问题

This commit is contained in:
zmister 2021-10-24 23:32:36 +08:00
parent 46ef5326e4
commit dcb4fcb23d

View File

@ -228,8 +228,8 @@ def getImageExtensionName(temps):
#image/png
temps = temps[0].split('image/')
if len(temps) == 2:
## 如果文件传了扩展名,就取扩展名的文件类型
if temps[-1] != '':
## 如果文件传了扩展名,就取扩展名的文件类型,判断图片格式是否允许上传
if temps[-1] in settings.ALLOWED_IMG:
return "." + temps[-1]
return ".png"