mirror of
https://github.com/hacdias/webdav.git
synced 2024-04-21 12:32:06 +00:00
fix: GET directory fails when non-root prefix configured (#40)
This commit is contained in:
+2
-2
@@ -127,8 +127,8 @@ func (c *Config) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
// the collection, or something else altogether.
|
||||
//
|
||||
// Get, when applied to collection, will return the same as PROPFIND method.
|
||||
if r.Method == "GET" {
|
||||
info, err := u.Handler.FileSystem.Stat(context.TODO(), r.URL.Path)
|
||||
if r.Method == "GET" && strings.HasPrefix(r.URL.Path, u.Handler.Prefix) {
|
||||
info, err := u.Handler.FileSystem.Stat(context.TODO(), strings.TrimPrefix(r.URL.Path, u.Handler.Prefix))
|
||||
if err == nil && info.IsDir() {
|
||||
r.Method = "PROPFIND"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user