]> source.dussan.org Git - gitea.git/commitdiff
Escape reference to `user` table in models.SearchEmails (#16313)
authorAdyanth H <33192449+adyanth@users.noreply.github.com>
Wed, 30 Jun 2021 16:37:20 +0000 (22:07 +0530)
committerGitHub <noreply@github.com>
Wed, 30 Jun 2021 16:37:20 +0000 (18:37 +0200)
Fix #16312

Signed-off-by: Adyanth H <adyanthh@gmail.com>
models/user_mail.go

index 2758dfb8e84f3812ac4b1c0c068cf21300f2f7f7..320f2cb05a325ff8a3d9f59b3dd9bac31e862cd1 100644 (file)
@@ -316,7 +316,7 @@ type SearchEmailResult struct {
 // SearchEmails takes options i.e. keyword and part of email name to search,
 // it returns results in given range and number of total results.
 func SearchEmails(opts *SearchEmailOptions) ([]*SearchEmailResult, int64, error) {
-       var cond builder.Cond = builder.Eq{"user.`type`": UserTypeIndividual}
+       var cond builder.Cond = builder.Eq{"`user`.`type`": UserTypeIndividual}
        if len(opts.Keyword) > 0 {
                likeStr := "%" + strings.ToLower(opts.Keyword) + "%"
                cond = cond.And(builder.Or(