diff options
| author | Paul Buetow <paul@buetow.org> | 2024-10-24 10:15:52 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-10-24 10:15:52 +0300 |
| commit | dde64be2724fd4e407315627943dd8dd37e5adf0 (patch) | |
| tree | de156e606819eaae4701ec71fe0e551e6b844313 /internal | |
| parent | bdcf87d33d73ad6b75c954e9b667ac084075746d (diff) | |
fix fuzz test
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/platforms/linkedin/escapes_test.go | 4 |
1 files changed, 3 insertions, 1 deletions
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) |
