From 9f218a45bb4f9afd46136f005fa99e7bd55cefc2 Mon Sep 17 00:00:00 2001 From: Roi Feng <37480123+Rayzggz@users.noreply.github.com> Date: Thu, 20 Mar 2025 16:16:53 -0400 Subject: [PATCH] fix: CAPTCHA ERROR cause by Undefined UA --- internal/utils/UAParser.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/utils/UAParser.go b/internal/utils/UAParser.go index f8dc088..b3ded30 100644 --- a/internal/utils/UAParser.go +++ b/internal/utils/UAParser.go @@ -3,10 +3,14 @@ package utils import ( "fmt" "github.com/mssola/useragent" + "regexp" ) func GetClearanceUserAgent(inputUA string) string { if len(inputUA) < 8 || inputUA[:8] != "Mozilla/" { + if inputUA == "" || regexp.MustCompile(`^\s*$`).MatchString(inputUA) { + return "undefined" + } return inputUA }