Finish the alpha version of webdav.
This commit is contained in:
parent
5e01dd1639
commit
6bd687301e
@ -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…
Reference in New Issue
Block a user