From ddc30e3d96649d85722ed8646fe8326b43a4474c Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 8 May 2017 10:53:15 -0400 Subject: [PATCH] fix empty search query bug --- service/torrent/torrent.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/service/torrent/torrent.go b/service/torrent/torrent.go index 40191c17..eb9a2309 100644 --- a/service/torrent/torrent.go +++ b/service/torrent/torrent.go @@ -6,8 +6,8 @@ import ( "github.com/ewhal/nyaa/db" "github.com/ewhal/nyaa/model" "github.com/ewhal/nyaa/util" - "strings" "strconv" + "strings" ) type WhereParams struct { @@ -64,7 +64,9 @@ func GetTorrentsOrderBy(parameters *WhereParams, orderBy string, limit int, offs var params []interface{} if parameters != nil { // if there is where parameters - conditions += " AND " + parameters.Conditions + if len(parameters.Conditions) > 0 { + conditions += " AND " + parameters.Conditions + } params = parameters.Params } db.ORM.Model(&torrents).Where(conditions, params...).Count(&count)