fix search issue
Former-commit-id: 6fcb2017aba409c3ec9480f9ea894702eee1be01 [formerly a9c45f3c83ed22a6852e4f7d2fef6155e4a05b26] [formerly bc5dc0641dad6309f33564d8969a42e4dbc37df9 [formerly ac7c4db4e14c17993b038813893acca1234275cb]] Former-commit-id: 4669eafeb0872c2b66183b1c78a2de756b58ca3b [formerly 75efe1c23c13cb34d8aaf1e14b70d9830be16023] Former-commit-id: 5fcc16ffee3df50f302940dab3497be71be7f81f
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user