Adding filer option disableDirListing

This commit is contained in:
chrislusf
2015-04-13 23:38:46 -07:00
parent 95c373e762
commit 98aa9cc068
4 changed files with 13 additions and 3 deletions

View File

@@ -54,6 +54,10 @@ func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Reque
}
func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request, isGetMethod bool) {
if strings.HasSuffix(r.URL.Path, "/") {
if fs.disableDirListing {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
fs.listDirectoryHandler(w, r)
return
}