summaryrefslogtreecommitdiff
path: root/actions.go
diff options
context:
space:
mode:
Diffstat (limited to 'actions.go')
-rw-r--r--actions.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/actions.go b/actions.go
index e521318..f497248 100644
--- a/actions.go
+++ b/actions.go
@@ -122,12 +122,22 @@ func purgeOldHistory(state *BrowserState) {
}
func gopherURL(u *url.URL) (string, sliderule.Status) {
- if u.Scheme != "gopher" || len(u.Path) < 2 || !strings.HasPrefix(u.Path, "/") {
+ if u.Scheme != "gopher" || !strings.HasPrefix(u.Path, "/") {
return u.String(), 0
}
- itemType := u.Path[1]
+
+ var itemType byte
+ var path string
+ if u.Path == "/" {
+ itemType = '1'
+ path = u.Path
+ } else {
+ itemType = u.Path[1]
+ path = u.Path[2:]
+ }
+
clone := *u
- clone.Path = u.Path[2:]
+ clone.Path = path
return clone.String(), sliderule.Status(itemType)
}