From 82aea26e5dda91e2ca5734e81925776dcbeea362 Mon Sep 17 00:00:00 2001 From: Petter Rodhelind Date: Sun, 21 Feb 2021 23:29:00 +0100 Subject: Present usage on empty path. --- main.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 1b93d8d..402ec8f 100644 --- a/main.go +++ b/main.go @@ -105,7 +105,16 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/favicon.ico" { return } + + if r.URL.Path == "/" { + http.Error(w, fmt.Sprintf("usage: %s/@facebookGroupName", r.Host), 400) + return + } + group := r.URL.Path[1:] + if group[0] == '@' { + group = group[1:] + } if strings.HasSuffix(group, ".rss") { group = strings.TrimSuffix(group, ".rss") outputMode = "rss" @@ -121,7 +130,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } if c == nil || len(c.Items) < 1 { - http.Error(w, fmt.Sprintf("%s", "group not found"), 400) + http.Error(w, fmt.Sprintf("%s", "Group not found."), 400) return } -- cgit v1.2.3