From dde64be2724fd4e407315627943dd8dd37e5adf0 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 24 Oct 2024 10:15:52 +0300 Subject: fix fuzz test --- internal/platforms/linkedin/escapes_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'internal') diff --git a/internal/platforms/linkedin/escapes_test.go b/internal/platforms/linkedin/escapes_test.go index c95ddc9..f93b260 100644 --- a/internal/platforms/linkedin/escapes_test.go +++ b/internal/platforms/linkedin/escapes_test.go @@ -2,6 +2,7 @@ package linkedin import ( "fmt" + "regexp" "slices" "strings" "testing" @@ -69,9 +70,10 @@ func FuzzLinkedInURLExtract(f *testing.F) { f.Add("/path?codsl=fpwfto6j") f.Add("tvdus=fhlhlh1y") f.Add("/foo.txt") + noWhitespace := regexp.MustCompile(`\s+`) f.Fuzz(func(t *testing.T, urlPath string) { - urlPath = strings.TrimSpace(urlPath) + urlPath = noWhitespace.ReplaceAllString(strings.TrimSpace(urlPath), "%20") baseURLs := []string{"https://foo.zone", "http://foo.zone", "ftp://foo.zone"} for _, baseURL := range baseURLs { fullURL := fmt.Sprintf("%s%s", baseURL, urlPath) -- cgit v1.2.3