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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: add RemoteFileUploadError for better error handling in remote fi… (#11933)
-LAN-0b0623552780
diff --git a/api/controllers/common/errors.py b/api/controllers/common/errors.pyindex c71f1ce5a31..9f762b3135e 100644--- a/api/controllers/common/errors.py+++ b/api/controllers/common/errors.py@@ -4,3 +4,8 @@ from werkzeug.exceptions import HTTPExceptionclass FilenameNotExistsError(HTTPException):code = 400description = "The specified filename does not exist."+++class RemoteFileUploadError(HTTPException):+ code = 400+ description = "Error uploading remote file."diff --git a/api/controllers/console/remote_files.py b/api/controllers/console/remote_files.pyindex fac1341b39b..b8cf019e4f0 100644--- a/api/controllers/console/remote_files.py+++ b/api/controllers/console/remote_files.py@@ -7,6 +7,7 @@ from flask_restful import Resource, marshal_with, reqparseimport servicesfrom controllers.common import helpers+from controllers.common.errors import RemoteFileUploadErrorfrom core.file import helpers as file_helpersfrom core.helper import ssrf_proxyfrom fields.file_fields import file_fields_with_signed_url, remote_file_info_fields@@ -43,10 +44,14 @@ class RemoteFileUploadApi(Resource):url = args["url"]- resp = ssrf_proxy.head(url=url)- if resp.status_code != httpx.codes.OK:- resp = ssrf_proxy.get(url=url, timeout=3, follow_redirects=True)- resp.raise_for_status()+ try:+ resp = ssrf_proxy.head(url=url)+ if resp.status_code != httpx.codes.OK:+ resp = ssrf_proxy.get(url=url, timeout=3, follow_redirects=True)+ if resp.status_code != httpx.codes.OK:+ raise RemoteFileUploadError(f"Failed to fetch file from {url}: {resp.text}")+ except httpx.RequestError as e:+ raise RemoteFileUploadError(f"Failed to fetch file from {url}: {str(e)}")file_info = helpers.guess_file_info_from_response(resp)diff --git a/api/controllers/web/remote_files.py b/api/controllers/web/remote_files.pyindex d6b8eb28557..ae68df6bdc4 100644--- a/api/controllers/web/remote_files.py+++ b/api/controllers/web/remote_files.py@@ -5,6 +5,7 @@ from flask_restful import marshal_with, reqparseimport servicesfrom controllers.common import helpers+from controllers.common.errors import RemoteFileUploadErrorfrom controllers.web.wraps import WebApiResourcefrom core.file import helpers as file_helpersfrom core.helper import ssrf_proxy@@ -38,10 +39,14 @@ class RemoteFileUploadApi(WebApiResource):url = args["url"]- resp = ssrf_proxy.head(url=url)- if resp.status_code != httpx.codes.OK:- resp = ssrf_proxy.get(url=url, timeout=3)- resp.raise_for_status()+ try:+ resp = ssrf_proxy.head(url=url)+ if resp.status_code != httpx.codes.OK:+ resp = ssrf_proxy.get(url=url, timeout=3, follow_redirects=True)+ if resp.status_code != httpx.codes.OK:+ raise RemoteFileUploadError(f"Failed to fetch file from {url}: {resp.text}")+ except httpx.RequestError as e:+ raise RemoteFileUploadError(f"Failed to fetch file from {url}: {str(e)}")file_info = helpers.guess_file_info_from_response(resp)