Fix: Prevent binary content from being stored in process_data for HTTP nodes (#27532)
Signed-off-by: -LAN- <laipz8200@outlook.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: -LAN- <laipz8200@outlook.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -412,16 +412,20 @@ class Executor:
|
|||||||
body_string += f"--{boundary}\r\n"
|
body_string += f"--{boundary}\r\n"
|
||||||
body_string += f'Content-Disposition: form-data; name="{key}"\r\n\r\n'
|
body_string += f'Content-Disposition: form-data; name="{key}"\r\n\r\n'
|
||||||
# decode content safely
|
# decode content safely
|
||||||
try:
|
# Do not decode binary content; use a placeholder with file metadata instead.
|
||||||
body_string += content.decode("utf-8")
|
# Includes filename, size, and MIME type for better logging context.
|
||||||
except UnicodeDecodeError:
|
body_string += (
|
||||||
body_string += content.decode("utf-8", errors="replace")
|
f"<file_content_binary: '{file_entry[1][0] or 'unknown'}', "
|
||||||
body_string += "\r\n"
|
f"type='{file_entry[1][2] if len(file_entry[1]) > 2 else 'unknown'}', "
|
||||||
|
f"size={len(content)} bytes>\r\n"
|
||||||
|
)
|
||||||
body_string += f"--{boundary}--\r\n"
|
body_string += f"--{boundary}--\r\n"
|
||||||
elif self.node_data.body:
|
elif self.node_data.body:
|
||||||
if self.content:
|
if self.content:
|
||||||
|
# If content is bytes, do not decode it; show a placeholder with size.
|
||||||
|
# Provides content size information for binary data without exposing the raw bytes.
|
||||||
if isinstance(self.content, bytes):
|
if isinstance(self.content, bytes):
|
||||||
body_string = self.content.decode("utf-8", errors="replace")
|
body_string = f"<binary_content: size={len(self.content)} bytes>"
|
||||||
else:
|
else:
|
||||||
body_string = self.content
|
body_string = self.content
|
||||||
elif self.data and self.node_data.body.type == "x-www-form-urlencoded":
|
elif self.data and self.node_data.body.type == "x-www-form-urlencoded":
|
||||||
|
|||||||
Reference in New Issue
Block a user