Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: file upload auth (#11774)

Joe580297e29038
diff --git a/api/controllers/console/files.py b/api/controllers/console/files.py
index 946d3db37f5..ca32d29efaa 100644
--- a/api/controllers/console/files.py
+++ b/api/controllers/console/files.py
@@ -1,6 +1,7 @@
from flask import request
from flask_login import current_user
from flask_restful import Resource, marshal_with
+from werkzeug.exceptions import Forbidden
import services
from configs import dify_config
@@ -58,6 +59,9 @@ class FileApi(Resource):
if not file.filename:
raise FilenameNotExistsError
+ if source == "datasets" and not current_user.is_dataset_editor:
+ raise Forbidden()
+
if source not in ("datasets", None):
source = None