mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-07 03:52:32 +08:00
Fix path traversal validation to return 400 instead of 500
Catch ValueError from resolve_destination_from_tags in the upload endpoint so that invalid path components like '..' return a 400 BAD_REQUEST error instead of falling through to the 500 handler. Amp-Thread-ID: https://ampcode.com/threads/T-019c2af2-7c87-7263-88b0-9feca1c31b3c Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
parent
abeec3072b
commit
16b5d9112b
@ -386,6 +386,9 @@ async def upload_asset(request: web.Request) -> web.Response:
|
|||||||
except AssetValidationError as e:
|
except AssetValidationError as e:
|
||||||
_delete_temp_file_if_exists(parsed.tmp_path)
|
_delete_temp_file_if_exists(parsed.tmp_path)
|
||||||
return _build_error_response(400, e.code, str(e))
|
return _build_error_response(400, e.code, str(e))
|
||||||
|
except ValueError as e:
|
||||||
|
_delete_temp_file_if_exists(parsed.tmp_path)
|
||||||
|
return _build_error_response(400, "BAD_REQUEST", str(e))
|
||||||
except HashMismatchError as e:
|
except HashMismatchError as e:
|
||||||
_delete_temp_file_if_exists(parsed.tmp_path)
|
_delete_temp_file_if_exists(parsed.tmp_path)
|
||||||
return _build_error_response(400, "HASH_MISMATCH", str(e))
|
return _build_error_response(400, "HASH_MISMATCH", str(e))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user