From 6bff2e05723a02e2204eeb037c8861c2e7aedcdc Mon Sep 17 00:00:00 2001 From: Daishan Peng Date: Wed, 18 Dec 2024 09:26:30 -0700 Subject: [PATCH] Fix: remove slash prefix when comparing with match pattern (#897) 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 7eb218d2e..a58b8246d 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 } }