From 147e42239f22c155cb0935b9988742d5c70c31c7 Mon Sep 17 00:00:00 2001
From: zeripath <art27@cantab.net>
Date: Sun, 19 Dec 2021 21:00:22 +0000
Subject: [PATCH] Stop printing 03d after escaped characters in logs (#18030)

Strangely a weird bug was present in the log escaping code whereby any escaped
character would gain 03d - this was due to a mistake in the format string where
it should have read %03o but read instead %o03d. This has led to spurious 03d
trailing characters on these escaped characters!

Signed-off-by: Andrew Thornton <art27@cantab.net>
---
 modules/log/colors.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/log/colors.go b/modules/log/colors.go
index 5d56fd7390..ad3120ee6c 100644
--- a/modules/log/colors.go
+++ b/modules/log/colors.go
@@ -259,7 +259,7 @@ normalLoop:
 		}
 
 		// Process naughty character
-		if _, err := fmt.Fprintf(c.w, `\%#o03d`, bytes[i]); err != nil {
+		if _, err := fmt.Fprintf(c.w, `\%#03o`, bytes[i]); err != nil {
 			return totalWritten, err
 		}
 		i++