Improve data processing in PageNode class to handle both dictionary and bytes input.
Some checks failed
Docker Build Test / build (3.10) (push) Successful in 11s
Docker Build Test / build (3.12) (push) Successful in 11s
Docker Build Test / build (3.13) (push) Successful in 35s
Docker Build Test / build (3.11) (push) Successful in 37s
Docker Build Test / build (3.9) (push) Successful in 37s
Build and Publish Docker Image / build (push) Has been cancelled

This commit is contained in:
2025-10-05 16:35:38 -05:00
parent 2def60b457
commit 5dfcc1f2ce

View File

@@ -190,9 +190,25 @@ class PageNode:
remote_identity.hash, remote_identity.hash,
delimit=False, delimit=False,
) )
if data and isinstance(data, bytes): if data:
try: try:
RNS.log(f"Processing request data: {data} (type: {type(data)})", RNS.LOG_DEBUG)
if isinstance(data, dict):
RNS.log(f"Data is dictionary with {len(data)} items", RNS.LOG_DEBUG)
for key, value in data.items():
if isinstance(value, str):
if key.startswith(("field_", "var_")):
env[key] = value
RNS.log(f"Set env[{key}] = {value}", RNS.LOG_DEBUG)
elif key == "action":
env["var_action"] = value
RNS.log(f"Set env[var_action] = {value}", RNS.LOG_DEBUG)
else:
env[f"field_{key}"] = value
RNS.log(f"Set env[field_{key}] = {value}", RNS.LOG_DEBUG)
elif isinstance(data, bytes):
data_str = data.decode("utf-8") data_str = data.decode("utf-8")
RNS.log(f"Data is bytes, decoded to: {data_str}", RNS.LOG_DEBUG)
if data_str: if data_str:
if "|" in data_str and "&" not in data_str: if "|" in data_str and "&" not in data_str:
pairs = data_str.split("|") pairs = data_str.split("|")