diff options
| author | tjp <tjp@ctrl-c.club> | 2024-07-14 13:26:32 -0600 |
|---|---|---|
| committer | tjp <tjp@ctrl-c.club> | 2024-07-14 13:26:32 -0600 |
| commit | ce6c5364068413fdfb40eca55fb4445e1cd49ff1 (patch) | |
| tree | c3e78294b6e6f93d72de7fd2ccc18958dc6afa02 /actions.go | |
| parent | b96e54f47ce56f8b703a62352306bd96dd9080e4 (diff) | |
default '1' gopher type when path == '/'
Diffstat (limited to 'actions.go')
| -rw-r--r-- | actions.go | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -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) } |
