beers: fix URL parameters for images

This commit is contained in:
Chris Sexton 2021-08-05 10:01:35 -04:00 committed by Chris Sexton
parent 13e16c9f01
commit 792f8681ab
1 changed files with 2 additions and 3 deletions

View File

@ -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 {