fix search issue

This commit is contained in:
Henrique Dias committed 2017-05-27 08:34:09 +01:00
1 parent 1ff0c6cb68
commit ac7c4db4e1
2 files changed
+14 -9

No files matched your search

+13 -8
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 {