From 30e1ed9f400bc8a8b1e0fcc48709d79ed5f9c726 Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Wed, 18 May 2022 16:56:13 +0200 Subject: [PATCH] fix(ooniprobe show): correctly handle % in the JSON (#738) This diff fixes the way in which we print JSON results inside `ooniprobe show ` by using the "%s" fmt specifier rather than using the JSON string itself as the format string. See https://github.com/ooni/probe/issues/2082 FWIW, `ooniprobe show --batch ` was already WAI. --- cmd/ooniprobe/internal/log/handlers/cli/measurements.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/ooniprobe/internal/log/handlers/cli/measurements.go b/cmd/ooniprobe/internal/log/handlers/cli/measurements.go index 8d74aca..cf1f022 100644 --- a/cmd/ooniprobe/internal/log/handlers/cli/measurements.go +++ b/cmd/ooniprobe/internal/log/handlers/cli/measurements.go @@ -137,6 +137,6 @@ func logMeasurementJSON(w io.Writer, f log.Fields) error { if err != nil { return err } - fmt.Fprintf(w, string(json)) + fmt.Fprintf(w, "%s", string(json)) return nil }