From 61e993c0083fd83a86b3ca2fe3c309428450f743 Mon Sep 17 00:00:00 2001 From: Mostyn Bramley-Moore Date: Thu, 10 Aug 2023 01:04:59 +0200 Subject: [PATCH] Improve invalid cache request error messages --- server/http.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/http.go b/server/http.go index cc229d5ca..6fe7bbba4 100644 --- a/server/http.go +++ b/server/http.go @@ -91,7 +91,7 @@ func NewHTTPCache(cache disk.Cache, accessLogger cache.Logger, errorLogger cache func parseRequestURL(url string, validateAC bool) (kind cache.EntryKind, hash string, instance string, err error) { m := blobNameSHA256.FindStringSubmatch(url) if m == nil { - err := fmt.Errorf("resource name must be a SHA256 hash in hex. "+ + err := fmt.Errorf("resource name must be a SHA256 hash in hex, "+ "got '%s'", html.EscapeString(url)) return 0, "", "", err } @@ -100,7 +100,7 @@ func parseRequestURL(url string, validateAC bool) (kind cache.EntryKind, hash st parts := m[2:] if len(parts) != 2 { - err := fmt.Errorf("the path '%s' is invalid. expected (ac/|cas/)sha256", + err := fmt.Errorf("the path '%s' is invalid, expected (ac/|cas/)sha256", html.EscapeString(url)) return 0, "", "", err }