- Fix url escape for webdav files

- Add support for bind address, url base
This commit is contained in:
Mukhtar Akere
2025-04-17 15:34:47 +01:00
parent 80615e06d1
commit 1983e27124

View File

@@ -14,6 +14,7 @@ import (
"io"
"net/http"
"net/http/httptest"
"net/url"
"os"
path "path/filepath"
"slices"
@@ -103,6 +104,12 @@ func (h *Handler) getParentFiles() []os.FileInfo {
func (h *Handler) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error) {
name = path.Clean("/" + name)
// unescape the path
name, err := url.PathUnescape(name)
if err != nil {
h.logger.Error().Err(err).Msg("Failed to unescape path")
return nil, err
}
rootDir := h.getRootPath()
metadataOnly := ctx.Value("metadataOnly") != nil