Support admin paths with index.html (#332)
This commit is contained in:
parent
73ec2126cc
commit
00b1e06840
@ -16,9 +16,12 @@ func ServeAdmin(w http.ResponseWriter, r *http.Request) {
|
|||||||
// Set a cache control max-age header
|
// Set a cache control max-age header
|
||||||
middleware.SetCachingHeaders(w, r)
|
middleware.SetCachingHeaders(w, r)
|
||||||
|
|
||||||
|
// Determine if the requested path is a directory.
|
||||||
|
// If so, append index.html to the request.
|
||||||
path := r.URL.Path
|
path := r.URL.Path
|
||||||
if path == "/admin" || path == "/admin/" {
|
dirCheck, err := pkger.Stat(path)
|
||||||
path = "/admin/index.html"
|
if dirCheck != nil && err == nil && dirCheck.IsDir() {
|
||||||
|
path = filepath.Join(path, "index.html")
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := pkger.Open(path)
|
f, err := pkger.Open(path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user