mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2026-03-18 19:17:25 +00:00
This fixes issue #1556 where the customrest backend fails when error messages contain quotes or other special characters. The root cause was that fmt.Sprintf was used to construct JSON, which doesn't escape special characters like quotes, newlines, or tabs. When Kubernetes error messages contain image names with quotes (e.g., "nginx:1.a.b.c"), the resulting JSON was malformed and failed to parse. The fix uses json.Marshal to properly construct the JSON payload, which automatically handles all special character escaping according to JSON spec. Fixes #1556 Signed-off-by: Three Foxes (in a Trenchcoat) <threefoxes53235@gmail.com> Co-authored-by: Three Foxes (in a Trenchcoat) <threefoxes53235@gmail.com>