mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
[ComfyUI] Should not replace ' to " in JSON string
#604
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AnotiaWang on GitHub (Aug 29, 2025).
Self Checks
Dify version
1.8.0
Plugin version
0.2.4
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
When calling the Workflow node, if the input JSON string contains
', it will be replaced by"inclean_json_string(), resulting to corrupted JSON structure.https://github.com/langgenius/dify-official-plugins/blob/f5a8c9e26c2fe1c19e6026320f3509a4c74f0709/tools/comfyui/tools/comfyui_workflow.py#L45
@yt-koike
✔️ Error log
No response
@dosubot[bot] commented on GitHub (Aug 29, 2025):
You're right—replacing all single quotes with double quotes in JSON strings is problematic and can corrupt valid JSON, especially if single quotes appear inside string values. The current implementation of
clean_json_string()incomfyui_workflow.pydoes this unconditionally, which is likely a bug and not compatible with JSON standards. JSON requires double quotes for keys and string values, and Python'sjson.loads()expects properly formatted JSON. Arbitrary replacement can break legitimate input and cause parsing errors like the one you reported. The recommended approach is to validate and parse JSON strictly usingjson.loads()and provide clear error messages for malformed input, rather than trying to "fix" quotes in preprocessing. You can see the problematic code and context here.To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

@yt-koike commented on GitHub (Aug 29, 2025):
Hello @AnotiaWang
Thank you very much for spotting out a bug! I really appreciate it. I'll make a PR to fix it as soon as possible.