From 6b8f2f8d448cb3b89d8f7ad147e6a5eb1d3c4da9 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Fri, 14 May 2021 01:12:00 +0200 Subject: cleanup: first occurance does not need to start at 0 --- skate/url.go | 2 +- skate/url_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'skate') diff --git a/skate/url.go b/skate/url.go index d8560ac..b37fe4d 100644 --- a/skate/url.go +++ b/skate/url.go @@ -36,7 +36,7 @@ func SanitizeURL(s string) string { ) if len(indices) > 1 { // http://ailab.ist.psu.edu/bcpred/SVMTriP:http://sysbio.unl.edu/SVMTriP/prediction.phpBcell - s = s[0:indices[1]] // only use the first + s = s[indices[0]:indices[1]] // only use the first s = strings.TrimRight(s, ":") s = strings.TrimRight(s, ";") } diff --git a/skate/url_test.go b/skate/url_test.go index 1a439a6..8f50162 100644 --- a/skate/url_test.go +++ b/skate/url_test.go @@ -124,6 +124,7 @@ func TestSanitizeURL(t *testing.T) { {`http.worldbank.org/sq`, `http://worldbank.org/sq`}, {`httpwww.sun.com`, `http://www.sun.com`}, {`httpswww.unos.org`, `http://www.unos.org`}, + {`ics.uci.edu/pub/ietf/`, `http://ics.uci.edu/pub/ietf/`}, } for _, c := range cases { out := SanitizeURL(c.in) -- cgit v1.2.3