main.go | 10 ++++++---- diff --git a/main.go b/main.go index 52454debe8d4d5eaa562c82bac686412dbd4992594dc99abac039d63b8bc6a69..9ab2cdfa1249e13381e314f36c2e67e6444de03146a96ee4ef993f0475fe2434 100644 --- a/main.go +++ b/main.go @@ -92,11 +92,13 @@ w.Header().Set("Server", UserAgent) switch r.Method { case "GET": var path string + var found bool var autorefresh bool - if strings.HasPrefix(r.URL.Path, *NoRefreshURLPath) { - path = strings.TrimPrefix(r.URL.Path, *NoRefreshURLPath) - } else if strings.HasPrefix(r.URL.Path, *RefreshURLPath) { - path = strings.TrimPrefix(r.URL.Path, *RefreshURLPath) + path, found = strings.CutPrefix(r.URL.Path, *NoRefreshURLPath) + if !found { + path, found = strings.CutPrefix(r.URL.Path, *RefreshURLPath) + } + if found { autorefresh = true } else { http.Error(w, "unknown action", http.StatusBadRequest)