Skip to content

fix(api): replace current_user with end_user in file upload #10194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions api/controllers/web/remote_files.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import urllib.parse

from flask_login import current_user
from flask_restful import marshal_with, reqparse

from controllers.common import helpers
Expand All @@ -27,7 +26,7 @@ def get(self, url):

class RemoteFileUploadApi(WebApiResource):
@marshal_with(file_fields_with_signed_url)
def post(self):
def post(self, app_model, end_user): # Add app_model and end_user parameters
parser = reqparse.RequestParser()
parser.add_argument("url", type=str, required=True, help="URL is required")
args = parser.parse_args()
Expand All @@ -51,7 +50,7 @@ def post(self):
filename=file_info.filename,
content=content,
mimetype=file_info.mimetype,
user=current_user,
user=end_user, # Use end_user instead of current_user
source_url=url,
)
except Exception as e:
Expand Down