mirror of
https://github.com/hacdias/webdav.git
synced 2026-09-25 20:51:53 +08: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.
|
// the collection, or something else altogether.
|
||||||
//
|
//
|
||||||
// Get, when applied to collection, will return the same as PROPFIND method.
|
// Get, when applied to collection, will return the same as PROPFIND method.
|
||||||
if r.Method == "GET" {
|
if r.Method == "GET" && strings.HasPrefix(r.URL.Path, u.Handler.Prefix) {
|
||||||
info, err := u.Handler.FileSystem.Stat(context.TODO(), r.URL.Path)
|
info, err := u.Handler.FileSystem.Stat(context.TODO(), strings.TrimPrefix(r.URL.Path, u.Handler.Prefix))
|
||||||
if err == nil && info.IsDir() {
|
if err == nil && info.IsDir() {
|
||||||
r.Method = "PROPFIND"
|
r.Method = "PROPFIND"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user