From 81ed3a3b639112ce54569f5f0f6e0d927ae8f716 Mon Sep 17 00:00:00 2001 From: Jochen Ehret Date: Thu, 6 Nov 2025 13:11:08 +0100 Subject: [PATCH] Fix panic in "cf curl" command when response contains {{ or }} * for details, see https://github.com/cloudfoundry/cli/issues/3594 --- command/v7/curl_command.go | 2 +- command/v7/curl_command_test.go | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/command/v7/curl_command.go b/command/v7/curl_command.go index 13094126f4..ebfa2d63ae 100644 --- a/command/v7/curl_command.go +++ b/command/v7/curl_command.go @@ -69,7 +69,7 @@ func (cmd CurlCommand) Execute(args []string) error { } cmd.UI.GetOut().Write(responseBodyBytes) } else { - cmd.UI.DisplayText(string(bytesToWrite)) + cmd.UI.DisplayTextLiteral(string(bytesToWrite)) } return nil diff --git a/command/v7/curl_command_test.go b/command/v7/curl_command_test.go index 561259997a..86a19aa24b 100644 --- a/command/v7/curl_command_test.go +++ b/command/v7/curl_command_test.go @@ -97,6 +97,17 @@ var _ = Describe("curl Command", func() { Expect(testUI.Out).To(Say("sarah, teal, and reid were here")) }) + When("the request contains double curly braces", func() { + BeforeEach(func() { + fakeActor.MakeCurlRequestReturns([]byte("{{ }}"), &http.Response{}, nil) + }) + + It("returns the literal text", func() { + Expect(executeErr).NotTo(HaveOccurred()) + Expect(testUI.Out).To(Say("{{ }}")) + }) + }) + When("the request errors", func() { BeforeEach(func() { fakeActor.MakeCurlRequestReturns([]byte{}, &http.Response{}, errors.New("this sucks"))