refactor: improve readability of content retrieval logic in RemoteFileApi

pull/18666/head
ZeroZ_JQ 1 year ago
parent 2348bea78c
commit 1b199828dd

@ -84,7 +84,11 @@ class RemoteFileApi(Resource):
raise FileTooLargeError("File size exceeds the limit.") raise FileTooLargeError("File size exceeds the limit.")
try: try:
content = resp.content if resp.request.method == "GET" else ssrf_proxy.get(url=url, timeout=10, follow_redirects=True).content content = (
resp.content
if resp.request.method == "GET"
else ssrf_proxy.get(url=url, timeout=10, follow_redirects=True).content
)
except httpx.TimeoutException: except httpx.TimeoutException:
raise RemoteFileUploadError(f"Request timed out while downloading file content from {url}.") raise RemoteFileUploadError(f"Request timed out while downloading file content from {url}.")
except httpx.RequestError as e: except httpx.RequestError as e:

Loading…
Cancel
Save