修复上传图片校验失败的问题

This commit is contained in:
梦凌汐 2025-06-05 02:12:26 +08:00
parent 7d79e4a3c9
commit 7c6eed2022
3 changed files with 22 additions and 22 deletions

View File

@ -60,6 +60,8 @@ def upload_image():
file.seek(0)
except Exception:
return jsonify({'error': '无效的图片文件'}), 400
except Exception:
return jsonify({'error': '无效的图片文件'}), 400
# 如果启用了NSFW检查
if AppConfig.ENABLE_NSFW_FILTER:
@ -81,8 +83,6 @@ def upload_image():
file.seek(0)
except Exception as e:
return jsonify({'error': f'NSFW检查失败: {str(e)}'}), 500
except Exception:
return jsonify({'error': '无效的图片文件'}), 400
# 获取文件大小并检查存储空间
file.seek(0, 2) # 移动到文件末尾