Browse Source

Finish the alpha version of webdav.

master
zicla 7 years ago
parent
commit
6bd687301e
  1. 9
      rest/dav_controller.go

9
rest/dav_controller.go

@ -6,6 +6,7 @@ import (
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"regexp" "regexp"
"strings"
) )
/** /**
@ -111,7 +112,13 @@ func (this *DavController) HandleRoutes(writer http.ResponseWriter, request *htt
strs := reg.FindStringSubmatch(path) strs := reg.FindStringSubmatch(path)
if len(strs) == 2 { if len(strs) == 2 {
var f = func(writer http.ResponseWriter, request *http.Request) { var f = func(writer http.ResponseWriter, request *http.Request) {
this.Index(writer, request, strs[1]) subPath := strs[1]
//保证subPath不是以/结尾的。
//最后多余的/要去掉
if strings.HasSuffix(subPath, "/") {
subPath = subPath[0 : len(subPath)-1]
}
this.Index(writer, request, subPath)
} }
return f, true return f, true
} }

Loading…
Cancel
Save