diff --git a/internal/http/handlers.go b/internal/http/handlers.go index 6bc9e67..c636971 100644 --- a/internal/http/handlers.go +++ b/internal/http/handlers.go @@ -6,6 +6,7 @@ import ( "dwelling-files/web" "log" "net/http" + "strings" "git.arav.su/Arav/httpr" ) @@ -30,7 +31,10 @@ func New(directoryPath *string, noFileHandling bool) *FilesHandlers { } func (h *FilesHandlers) Index(w http.ResponseWriter, r *http.Request) { - path := "/" + httpr.Param(r, "filepath") + "/" + path := "/" + httpr.Param(r, "filepath") + if !strings.HasSuffix(path, "/") { + path += "/" + } currentPath := files.CurrentPath(path)