feat: support plugin max package size

This commit is contained in:
Yeuoly
2024-10-17 18:44:16 +08:00
parent fa7215cfea
commit 7754431a34
7 changed files with 186 additions and 6 deletions

View File

@ -84,6 +84,11 @@ class PluginUploadFromPkgApi(Resource):
tenant_id = user.current_tenant_id
file = request.files["pkg"]
# check file size
if file.content_length > dify_config.PLUGIN_MAX_PACKAGE_SIZE:
raise ValueError("File size exceeds the maximum allowed size")
content = file.read()
response = PluginService.upload_pkg(tenant_id, content)