This commit is contained in:
Henrique Dias
2016-11-01 15:00:36 +00:00
parent 11b37114dc
commit d8d7502b1c
6 changed files with 145 additions and 26 deletions

View File

@@ -67,10 +67,6 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
user = c.User
}
if r.URL.Query().Get("command") != "" {
return handlers.Command(w, r, c, user)
}
// Checks if the request URL is for the WebDav server
if strings.HasPrefix(r.URL.Path, c.WebDavURL) {
// Checks for user permissions relatively to this PATH
@@ -112,6 +108,14 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
return http.StatusForbidden, nil
}
if r.URL.Query().Get("search") != "" {
return handlers.Search(w, r, c, user)
}
if r.URL.Query().Get("command") != "" {
return handlers.Command(w, r, c, user)
}
if r.Method == http.MethodGet {
// Gets the information of the directory/file
fi, code, err = file.GetInfo(r.URL, c, user)