twitterchiver/viewer: fix media serving

This commit is contained in:
Luke Granger-Brown 2020-10-22 00:34:12 +00:00
parent d91b1baebc
commit 27b1e70ac1

View file

@ -140,7 +140,7 @@ func main() {
fmt.Fprintf(rw, "<p>%s</p>", wrap)
}
authR.Handle("/media/{path}", http.StripPrefix("/media/", http.FileServer(http.Dir(*mediaDirectory))))
authR.PathPrefix("/media/").Handler(http.StripPrefix("/media/", http.FileServer(http.Dir(*mediaDirectory))))
authR.HandleFunc("/", func(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
user := userFromContext(ctx)