Huge rework to more modern code
This commit is contained in:
parent
6564d9c4fa
commit
4fcf12dff2
8 changed files with 288 additions and 174 deletions
|
|
@ -10,10 +10,10 @@ type imagesHandler struct {
|
|||
name string
|
||||
auth func(*http.Request) bool
|
||||
hndlr http.Handler
|
||||
getter func(fname string) (Picture, error)
|
||||
getter func(fname string) (*Picture, error)
|
||||
}
|
||||
|
||||
func ImagesHandler(name string, auth func(*http.Request) bool, hndlr http.Handler, getter func(fname string) (Picture, error)) imagesHandler {
|
||||
func ImagesHandler(name string, auth func(*http.Request) bool, hndlr http.Handler, getter func(fname string) (*Picture, error)) imagesHandler {
|
||||
return imagesHandler{name, auth, hndlr, getter}
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ func (i imagesHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
http.Error(w, err.Error(), http.StatusNotFound)
|
||||
return
|
||||
} else {
|
||||
r.URL.Path = "/" + pict.basename
|
||||
r.URL.Path = "/" + pict.path
|
||||
i.hndlr.ServeHTTP(w, r)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue