Skip to content

Commit

Permalink
fix: file upload auth (langgenius#11774)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhouhaoJiang authored and 刘江波 committed Dec 20, 2024
1 parent a1980ba commit a64c2c7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/controllers/console/files.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -58,6 +59,9 @@ def post(self):
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

Expand Down

0 comments on commit a64c2c7

Please sign in to comment.