summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-10-24 10:15:52 +0300
committerPaul Buetow <paul@buetow.org>2024-10-24 10:15:52 +0300
commitdde64be2724fd4e407315627943dd8dd37e5adf0 (patch)
treede156e606819eaae4701ec71fe0e551e6b844313
parentbdcf87d33d73ad6b75c954e9b667ac084075746d (diff)
fix fuzz test
-rw-r--r--Taskfile.yml2
-rw-r--r--internal/platforms/linkedin/escapes_test.go4
2 files changed, 4 insertions, 2 deletions
diff --git a/Taskfile.yml b/Taskfile.yml
index 2282f02..5de7842 100644
--- a/Taskfile.yml
+++ b/Taskfile.yml
@@ -15,7 +15,7 @@ tasks:
cmds:
- go build -o gos cmd/gos/main.go
dev:
- deps: ["test", "fuzz", "vet", "lint"]
+ deps: ["test", "vet", "lint"]
cmds:
- go build -race -o gos cmd/gos/main.go
test:
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)