mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
httpd: disable directory index for static files
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -18,16 +18,20 @@
|
||||
package httpd
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/internal/bundle"
|
||||
)
|
||||
|
||||
func serveStaticDir(router chi.Router, path, _ string) {
|
||||
func serveStaticDir(router chi.Router, path, fsDirPath string, disableDirectoryIndex bool) {
|
||||
switch path {
|
||||
case webStaticFilesPath:
|
||||
fileServer(router, path, bundle.GetStaticFs())
|
||||
fileServer(router, path, bundle.GetStaticFs(), disableDirectoryIndex)
|
||||
case webOpenAPIPath:
|
||||
fileServer(router, path, bundle.GetOpenAPIFs())
|
||||
fileServer(router, path, bundle.GetOpenAPIFs(), disableDirectoryIndex)
|
||||
default:
|
||||
fileServer(router, path, http.Dir(fsDirPath), disableDirectoryIndex)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user