- Fix url escape for webdav files
- Add support for bind address, url base
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
path "path/filepath"
|
path "path/filepath"
|
||||||
"slices"
|
"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) {
|
func (h *Handler) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error) {
|
||||||
name = path.Clean("/" + name)
|
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()
|
rootDir := h.getRootPath()
|
||||||
|
|
||||||
metadataOnly := ctx.Value("metadataOnly") != nil
|
metadataOnly := ctx.Value("metadataOnly") != nil
|
||||||
|
|||||||
Reference in New Issue
Block a user