save file using webdav

This commit is contained in:
Henrique Dias
2016-10-18 16:17:01 +01:00
parent 10f7ae1d0d
commit 59f5109617
4 changed files with 47 additions and 43 deletions

View File

@@ -57,6 +57,13 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
}
if c.WebDav && strings.HasPrefix(r.URL.Path, c.WebDavURL) {
if r.Method == http.MethodPut {
_, err = fi.Update(w, r, c, user)
if err != nil {
return http.StatusInternalServerError, err
}
}
//url := strings.TrimPrefix(r.URL.Path, c.WebDavURL)
/*
@@ -143,17 +150,6 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
return errors.PrintHTML(w, code, err)
}
return code, err
case http.MethodPut:
if fi.IsDir {
return http.StatusNotAcceptable, nil
}
if !user.AllowEdit {
return http.StatusForbidden, nil
}
// Update a file.
return fi.Update(w, r, c, user)
case http.MethodPost:
// Upload a new file.
if r.Header.Get("Upload") == "true" {
@@ -166,7 +162,7 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
// Search and git commands.
if r.Header.Get("Search") == "true" {
// TODO: search commands.
// TODO: search commands. USE PROPFIND?
}
// VCS commands.