fix search issue
parent
1ff0c6cb68
commit
ac7c4db4e1
|
@ -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"
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue