fix search modifying in server
This commit is contained in:
@@ -281,10 +281,11 @@ func (server *Server) urlFileId(id []string) string {
|
||||
if len(id) == 0 {
|
||||
return ""
|
||||
}
|
||||
result := id[0]
|
||||
for i := 1; i < len(id); i++ {
|
||||
id[0] = strings.Join([]string{id[0], url.PathEscape(id[i])}, "/")
|
||||
result = strings.Join([]string{result, url.PathEscape(id[i])}, "/")
|
||||
}
|
||||
return id[0]
|
||||
return result
|
||||
}
|
||||
|
||||
func (server *Server) fileId(r *http.Request) []string {
|
||||
@@ -350,7 +351,7 @@ func (server *Server) apiV0SearchHandler(w http.ResponseWriter, r *http.Request)
|
||||
result := []string{}
|
||||
if err := tree.ForEach(func(id []string, leaf Leaf) error {
|
||||
for _, pattern := range patterns {
|
||||
if !pattern.MatchString(leaf.Content) && !pattern.MatchString(fmt.Sprint(id)) {
|
||||
if !pattern.MatchString(leaf.Content) && !pattern.MatchString(leaf.Title) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user