From ba6a8cbcdf407346a51f29d6f6b278098f8d48a2 Mon Sep 17 00:00:00 2001 From: Daishan Peng Date: Mon, 16 Dec 2024 16:45:49 -0700 Subject: [PATCH] Fix: remove slash prefix when comparing with match pattern Signed-off-by: Daishan Peng --- pkg/controller/handlers/knowledgefile/knowledgefile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/controller/handlers/knowledgefile/knowledgefile.go b/pkg/controller/handlers/knowledgefile/knowledgefile.go index 0313439a..dbdbf360 100644 --- a/pkg/controller/handlers/knowledgefile/knowledgefile.go +++ b/pkg/controller/handlers/knowledgefile/knowledgefile.go @@ -404,7 +404,7 @@ func (h *Handler) Cleanup(req router.Request, _ router.Response) error { func isFileMatchPrefixPattern(filePath string, patterns []string) bool { for _, pattern := range patterns { - if strings.HasPrefix(filePath, pattern) { + if strings.HasPrefix(strings.TrimPrefix(filePath, "/"), pattern) { return true } }