Skip to content

Commit

Permalink
rewrite "" search queries as ``
Browse files Browse the repository at this point in the history
  • Loading branch information
sentriz committed Jul 22, 2022
1 parent de54096 commit 6c94f19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
7 changes: 2 additions & 5 deletions server/ctrlsubsonic/handlers_by_folder.go
Expand Up @@ -7,9 +7,9 @@ import (

"github.com/jinzhu/gorm"

"go.senan.xyz/gonic/db"
"go.senan.xyz/gonic/server/ctrlsubsonic/params"
"go.senan.xyz/gonic/server/ctrlsubsonic/spec"
"go.senan.xyz/gonic/db"
)

// the subsonic spec mentions "artist" a lot when talking about the
Expand Down Expand Up @@ -177,10 +177,7 @@ func (c *Controller) ServeSearchTwo(r *http.Request) *spec.Response {
if err != nil {
return spec.NewError(10, "please provide a `query` parameter")
}
if query == `""` {
query = ""
}
query = fmt.Sprintf("%%%s%%", strings.TrimSuffix(query, "*"))
query = fmt.Sprintf("%%%s%%", strings.Trim(query, `*"'`))

results := &spec.SearchResultTwo{}

Expand Down
5 changes: 1 addition & 4 deletions server/ctrlsubsonic/handlers_by_tags.go
Expand Up @@ -182,10 +182,7 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response {
if err != nil {
return spec.NewError(10, "please provide a `query` parameter")
}
if query == `""` {
query = ""
}
query = fmt.Sprintf("%%%s%%", strings.TrimSuffix(query, "*"))
query = fmt.Sprintf("%%%s%%", strings.Trim(query, `*"'`))
results := &spec.SearchResultThree{}

// search "artists"
Expand Down

0 comments on commit 6c94f19

Please sign in to comment.