Complete move to IndexedDB
This commit is contained in:
9
main.go
9
main.go
@@ -55,9 +55,16 @@ func (lh *LoggingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
// noDirListing wraps an http.FileServer handler to prevent directory listings
|
||||
func noDirListing(h http.Handler, root string) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
// Serve index.html when root is requested
|
||||
if r.URL.Path == "/" {
|
||||
http.ServeFile(w, r, filepath.Join(root, "index.html"))
|
||||
return
|
||||
}
|
||||
|
||||
// Check if the path is a directory
|
||||
path := filepath.Join(root, r.URL.Path)
|
||||
if info, err := os.Stat(path); err == nil && info.IsDir() {
|
||||
http.NotFound(w, r) // Always return 404 for directories
|
||||
http.NotFound(w, r) // Return 404 for directories other than root
|
||||
return
|
||||
}
|
||||
h.ServeHTTP(w, r)
|
||||
|
||||
Reference in New Issue
Block a user