Skip to content

Conversation

@LolitaIceMia
Copy link

Reasoning:
The previous implementation used manual string concatenation to build the WebSocket response payload ({moduleName:..., output:...}).

This method failed to correctly escape special characters (e.g., quotes, newlines, control characters) potentially present in the 'output' data from backend modules.

This resulted in corrupted JSON strings, causing frontend clients (JavaScript's JSON.parse) to fail parsing the message, leading to "module output not found" or display errors in the UI.

Solution:
Replaced manual string concatenation with standard JSON.stringify(responsePayload) to ensure automatic and correct character escaping, guaranteeing valid JSON transmission to the frontend client.

Reasoning:
The previous implementation used manual string concatenation to build the WebSocket response payload ({moduleName:..., output:...}).

This method failed to correctly escape special characters (e.g., quotes, newlines, control characters) potentially present in the 'output' data from backend modules.

This resulted in corrupted JSON strings, causing frontend clients (JavaScript's JSON.parse) to fail parsing the message, leading to "module output not found" or display errors in the UI.

Solution:
Replaced manual string concatenation with standard JSON.stringify(responsePayload) to ensure automatic and correct character escaping, guaranteeing valid JSON transmission to the frontend client.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant