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.
This commit is contained in:
xvqxy 2022-02-21 10:14:11 +01:00 committed by GitHub
parent 83a257b16b
commit b52e3cf0d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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])
}
}