From 792f8681aba1222cd47a51e52ddbd342ebbe1da7 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Thu, 5 Aug 2021 10:01:35 -0400 Subject: [PATCH] beers: fix URL parameters for images --- plugins/beers/beers.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/beers/beers.go b/plugins/beers/beers.go index f3facb3..be666c1 100644 --- a/plugins/beers/beers.go +++ b/plugins/beers/beers.go @@ -591,13 +591,12 @@ func (p *BeersPlugin) untappdLoop(c bot.Connector, channel string) { func (p *BeersPlugin) registerWeb() { r := chi.NewRouter() - r.HandleFunc("/img", p.img) + r.HandleFunc("/img/{id}", p.img) p.b.RegisterWeb(r, "/beers") } func (p *BeersPlugin) img(w http.ResponseWriter, r *http.Request) { - _, file := path.Split(r.URL.Path) - id := file + id := chi.URLParam(r, "id") if img, ok := cachedImages[id]; ok { w.Write(img) } else {