From 1fe889c4e3c5703dcdbfb4761b5092f122fd8bdd Mon Sep 17 00:00:00 2001 From: hoelee Date: Thu, 16 Apr 2026 08:08:00 +0800 Subject: [PATCH] feat(botfilter): add hasStaticAssetExtension --- matcher.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/matcher.go b/matcher.go index 80a852a7..d6b82a4d 100644 --- a/matcher.go +++ b/matcher.go @@ -88,3 +88,12 @@ func pathMatchesAny(requestPath string, rules []string) bool { return false } +func hasStaticAssetExtension(requestPath string) bool { + for _, extension := range []string{".css", ".js", ".mjs", ".png", ".jpg", ".jpeg", ".gif", ".svg", ".webp", ".ico", ".woff", ".woff2"} { + if strings.HasSuffix(requestPath, extension) { + return true + } + } + return false +} +