- Fix url escape for webdav files
- Add support for bind address, url base
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user