From 17cd75654fd4e1442c99c1d295db7e0f50df4ab6 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Mon, 18 Jul 2022 19:11:23 -0600 Subject: [PATCH] Fix the FindPrivateChats SELECT statement The % needs to be escaped in the LIKE statement. Closes #532 --- database/portal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/portal.go b/database/portal.go index eefa71f..52980da 100644 --- a/database/portal.go +++ b/database/portal.go @@ -84,7 +84,7 @@ func (pq *PortalQuery) GetAllByJID(jid types.JID) []*Portal { } func (pq *PortalQuery) FindPrivateChats(receiver types.JID) []*Portal { - return pq.getAll(fmt.Sprintf("SELECT %s FROM portal WHERE receiver=$1 AND jid LIKE '%@s.whatsapp.net'", portalColumns), receiver.ToNonAD()) + return pq.getAll(fmt.Sprintf("SELECT %s FROM portal WHERE receiver=$1 AND jid LIKE '%%@s.whatsapp.net'", portalColumns), receiver.ToNonAD()) } func (pq *PortalQuery) FindPrivateChatsNotInSpace(receiver types.JID) (keys []PortalKey) {