mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Handle index.html correctly in custom served folders (#3168)
* getStringMapString return nil if key not found * Refactor custom routes. Handle /index.html
This commit is contained in:
@@ -231,18 +231,9 @@ func Start() error {
|
||||
// Serve static folders
|
||||
customServedFolders := c.GetCustomServedFolders()
|
||||
if customServedFolders != nil {
|
||||
r.HandleFunc("/custom/*", func(w http.ResponseWriter, r *http.Request) {
|
||||
r.URL.Path = strings.Replace(r.URL.Path, "/custom", "", 1)
|
||||
|
||||
// map the path to the applicable filesystem location
|
||||
var dir string
|
||||
r.URL.Path, dir = customServedFolders.GetFilesystemLocation(r.URL.Path)
|
||||
if dir != "" {
|
||||
http.FileServer(http.Dir(dir)).ServeHTTP(w, r)
|
||||
} else {
|
||||
http.NotFound(w, r)
|
||||
}
|
||||
})
|
||||
r.Mount("/custom", customRoutes{
|
||||
servedFolders: customServedFolders,
|
||||
}.Routes())
|
||||
}
|
||||
|
||||
customUILocation := c.GetCustomUILocation()
|
||||
|
||||
Reference in New Issue
Block a user