fix search issue

pull/144/head
Henrique Dias 2017-05-27 08:34:09 +01:00
parent 1ff0c6cb68
commit ac7c4db4e1
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
2 changed files with 14 additions and 9 deletions

View File

@ -149,7 +149,7 @@ FileManager allows you to search through your files and it has some options. By
this are keywords
```
If you search for that it will look at every file that contains "this", "are" and "keywords" on their name. If you want to search for an exact term, you should surround your search by double quotes:
If you search for that it will look at every file that contains "this", "are" or "keywords" on their name. If you want to search for an exact term, you should surround your search by double quotes:
```
"this is the name"

View File

@ -85,24 +85,29 @@ func Search(w http.ResponseWriter, r *http.Request, c *config.Config, u *config.
}
path = strings.Replace(path, "\\", "/", -1)
is := false
for _, term := range search.Terms {
if is {
break
}
if strings.Contains(path, term) {
if !u.Allowed(path) {
return nil
}
path = strings.TrimPrefix(path, scope)
path = strings.TrimPrefix(path, "/")
err = conn.WriteMessage(websocket.TextMessage, []byte(path))
if err != nil {
return err
}
is = true
}
}
return nil
if !is {
return nil
}
path = strings.TrimPrefix(path, scope)
path = strings.TrimPrefix(path, "/")
return conn.WriteMessage(websocket.TextMessage, []byte(path))
})
if err != nil {