summaryrefslogtreecommitdiff
path: root/href.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-08-20 16:03:49 +0200
committerDimitri Sokolyuk <demon@dim13.org>2018-08-20 16:03:49 +0200
commita4b642477e28f412d48ee64e0f2e7b8d41c54d94 (patch)
treebd8310d457d4b6b21642fc55a799b81b65802af1 /href.go
parentc99ea081a7fcd589b05125c5088b1557c1a25dfa (diff)
trim space in title
Diffstat (limited to 'href.go')
-rw-r--r--href.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/href.go b/href.go
index 0869afd..007731f 100644
--- a/href.go
+++ b/href.go
@@ -41,7 +41,10 @@ func title(r io.Reader) (string, error) {
if !utf8.Valid(t) {
return "", errNotText
}
- return string(t), nil
+ if s := strings.TrimSpace(string(t)); len(s) > 0 {
+ return s, nil
+ }
+ return "", errNoTitle
}
}
}