Start implementing webdav

This commit is contained in:
Henrique Dias committed 2016-10-17 21:05:52 +01:00
1 parent db4b01839a
commit 86b06b3f06
2 files changed
+45 -17

No files matched your search

+5 -2
View File
@@ -49,8 +49,6 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
if httpserver.Path(r.URL.Path).Matches(f.Configs[i].BaseURL) {
c = &f.Configs[i]
serveAssets = httpserver.Path(r.URL.Path).Matches(c.BaseURL + assets.BaseURL)
// Set the current user.
username, _, _ := r.BasicAuth()
if _, ok := c.Users[username]; ok {
@@ -59,6 +57,11 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
user = c.User
}
if c.WebDav && strings.HasPrefix(r.URL.Path, c.WebDavURL) {
c.WebDavHandler.ServeHTTP(w, r)
return 0, nil
}
// Checks if the user has permission to access the current directory.
if !user.Allowed(r.URL.Path) {
if r.Method == http.MethodGet {