From 8af646730be93f4a00b873d1822bfde6be106696 Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Thu, 22 Aug 2024 20:32:44 +0300 Subject: [PATCH] caddyhttp: run `error` (msg) through replacer (#6536) * error: run `error` (msg) through replacer Signed-off-by: Mohammed Al Sahaf * fix integration test Signed-off-by: Mohammed Al Sahaf --------- Signed-off-by: Mohammed Al Sahaf --- caddytest/caddytest_test.go | 1 - modules/caddyhttp/staticerror.go | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/caddytest/caddytest_test.go b/caddytest/caddytest_test.go index 937537fa..a9d5da93 100644 --- a/caddytest/caddytest_test.go +++ b/caddytest/caddytest_test.go @@ -84,7 +84,6 @@ func TestLoadUnorderedJSON(t *testing.T) { "servers": { "s_server": { "listen": [ - ":9443", ":9080" ], "routes": [ diff --git a/modules/caddyhttp/staticerror.go b/modules/caddyhttp/staticerror.go index b6e10ff3..aeb31140 100644 --- a/modules/caddyhttp/staticerror.go +++ b/modules/caddyhttp/staticerror.go @@ -105,8 +105,7 @@ func (e StaticError) ServeHTTP(w http.ResponseWriter, r *http.Request, _ Handler } statusCode = intVal } - - return Error(statusCode, fmt.Errorf("%s", e.Error)) + return Error(statusCode, fmt.Errorf("%s", repl.ReplaceKnown(e.Error, ""))) } // Interface guard