mirror of https://github.com/velour/catbase.git
beers: fix URL parameters for images
This commit is contained in:
parent
13e16c9f01
commit
792f8681ab
|
@ -591,13 +591,12 @@ func (p *BeersPlugin) untappdLoop(c bot.Connector, channel string) {
|
||||||
|
|
||||||
func (p *BeersPlugin) registerWeb() {
|
func (p *BeersPlugin) registerWeb() {
|
||||||
r := chi.NewRouter()
|
r := chi.NewRouter()
|
||||||
r.HandleFunc("/img", p.img)
|
r.HandleFunc("/img/{id}", p.img)
|
||||||
p.b.RegisterWeb(r, "/beers")
|
p.b.RegisterWeb(r, "/beers")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *BeersPlugin) img(w http.ResponseWriter, r *http.Request) {
|
func (p *BeersPlugin) img(w http.ResponseWriter, r *http.Request) {
|
||||||
_, file := path.Split(r.URL.Path)
|
id := chi.URLParam(r, "id")
|
||||||
id := file
|
|
||||||
if img, ok := cachedImages[id]; ok {
|
if img, ok := cachedImages[id]; ok {
|
||||||
w.Write(img)
|
w.Write(img)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue