Fix the FindPrivateChats SELECT statement

The % needs to be escaped in the LIKE statement.

Closes #532
This commit is contained in:
Sumner Evans 2022-07-18 19:11:23 -06:00
parent 465ffa27af
commit 17cd75654f
No known key found for this signature in database
GPG key ID: 8904527AB50022FD

View file

@ -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) {