aboutsummaryrefslogtreecommitdiffstats
path: root/skate/url.go
diff options
context:
space:
mode:
Diffstat (limited to 'skate/url.go')
-rw-r--r--skate/url.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/skate/url.go b/skate/url.go
index 66b9312..b104651 100644
--- a/skate/url.go
+++ b/skate/url.go
@@ -15,7 +15,9 @@ var (
)
// SanitizeURL applies various cleanup rules on URLs as found in references.
-// XXX: Sometimes a URL contains other identifying information, like:
+// Returns an empty string when no URL could be constructed. Still, many
+// results will not be a URL after all. XXX: Sometimes a URL contains other
+// identifying information, like:
// http://agingmind.utdallas.edu/facedb/view/neutral-faces.doi:10.3758/BF03206543.
// http://10.3386/w20634https://doi.org/10.3386/w20634
func SanitizeURL(s string) string {
@@ -24,7 +26,7 @@ func SanitizeURL(s string) string {
index = suffixarray.New([]byte(s))
indices = index.Lookup([]byte("http"), -1)
)
- if !strings.HasPrefix(s, "http") {
+ if !strings.HasPrefix(s, "http") && !strings.HasPrefix(s, "ftp") {
s = sanitizeRaw(s, index)
if s == "" {
return s