瀏覽代碼

fix(aur): -Ss fails on multi arg if no results. (#1716)

This fixes #1674.

If search command included multiple packages and no results were found
in AUR, response from `query.queryAUR` was returned
as nil slice instead of non-nil empty slice and as nil slice is treated
during subsequent validation in `query.SourceQueryBuilder.Results` as
meaning that searching in AUR was not executed, command was failing.
Now empty non-nil slice is returned if results were not found.
xvqxy 3 年之前
父節點
當前提交
b52e3cf0d2
共有 1 個文件被更改,包括 1 次插入6 次删除
  1. 1 6
      pkg/query/source.go

+ 1 - 6
pkg/query/source.go

@@ -188,10 +188,7 @@ func queryAUR(ctx context.Context, aurClient *aur.Client, pkgS []string, searchB
 		return r, err
 	}
 
-	var (
-		aq aurQuery
-		n  int
-	)
+	aq := make(aurQuery, 0, len(r))
 
 	for i := range r {
 		match := true
@@ -213,8 +210,6 @@ func queryAUR(ctx context.Context, aurClient *aur.Client, pkgS []string, searchB
 		}
 
 		if match {
-			n++
-
 			aq = append(aq, r[i])
 		}
 	}