Fixes an off-by-one comparison in the previous endpoint that prevented
the second site in the order (list index #1) from ever redirecting to
the first (list index #0).
Signed-off-by: Taavi Väänänen <hi@taavi.wtf>
---
handlers.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/handlers.go b/handlers.go
index 609525f..e219510 100644
--- a/handlers.go+++ b/handlers.go
@@ -84,7 +84,7 @@ func (m model) previous(writer http.ResponseWriter, request *http.Request) {
for index, item := range m.ring {
if item.url == host {
// from here to start of list
- for i := index - 1; i > 0; i-- {+ for i := index - 1; i >= 0; i-- { dest := scheme + m.ring[i].url
if is200(dest) {
log.Println("Redirecting visitor to '" + dest + "'")
--
2.43.0