Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parentheses are not escaped properly in SQL query when searching for lists #1471

Closed
tosie opened this issue Aug 21, 2023 · 1 comment
Closed
Assignees

Comments

@tosie
Copy link
Contributor

tosie commented Aug 21, 2023

Version:

  • listmonk: v2.5.1
  • OS: Debian 6.1.27-1 (2023-05-08) x86_64

Description of the bug and steps to reproduce:
When searching for a list with a string that contains parentheses, an error is returned by "pq".

Searching for "My list (something)" shows this error message:

error fetching lists: pq: syntax error in tsquery: "%My&list&(something)%"

Escaping the parentheses manually ("My list \(something\)") works (see second screenshot).

Screenshots:
image

image

@tosie tosie added the bug Something isn't working label Aug 21, 2023
@knadh knadh self-assigned this Aug 22, 2023
@knadh knadh added minor-bug and removed bug Something isn't working labels Aug 27, 2023
@knadh knadh closed this as completed in 83c88d7 Aug 27, 2023
@FournyP
Copy link

FournyP commented Sep 4, 2023

Hi, I try to fetch lists with the API using this query : 'alerts' = ANY(lists.tags)
So I got a query like this : http://localhost:9000/api/lists?query=%27alerts%27%3DANY%28lists.tags%29

But it doesn't work because of this issue. I've added \ as you said to fix the problem and I get a 200 response but with empty data

The query is : http://localhost:9000/api/lists?query=%27alerts%27%3DANY%5C%28lists.tags%5C%29 and as you can see, I don't get the same result between the API and the database
image
image

Do you know why the API don't return the value ?

Have a good day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants