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

Filter by free-form text with single quotes returns 500 #99

Open
wwtamu opened this issue Jul 29, 2024 · 0 comments
Open

Filter by free-form text with single quotes returns 500 #99

wwtamu opened this issue Jul 29, 2024 · 0 comments

Comments

@wwtamu
Copy link

wwtamu commented Jul 29, 2024

The solution is to escape single quotes for all filter by text in the dynamic query.

2024-07-29 18:28:59.359 ERROR 1 --- [io-9000-exec-66] o.a.c.c.C.[.[.[.[dispatcherServlet]      : Servlet.service() for servlet [dispatcherServlet] in context with path [/etd] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [SELECT COUNT(DISTINCT s.id) FROM submission s
LEFT JOIN submission_status ss ON ss.id=s.submission_status_id
LEFT JOIN weaver_users a ON a.id=s.assignee_id
LEFT JOIN action_log al ON al.id=s.last_action_id
WHERE ( (LOWER(al.entry) LIKE '%submission status changed to 'archived'%'))
]; nested exception is org.postgresql.util.PSQLException: ERROR: syntax error at or near "archived"
  Position: 269] with root cause
org.postgresql.util.PSQLException: ERROR: syntax error at or near "archived"
  Position: 269
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2675) ~[postgresql-42.3.8.jar:42.3.8]
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2365) ~[postgresql-42.3.8.jar:42.3.8]
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:355) ~[postgresql-42.3.8.jar:42.3.8]
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:490) ~[postgresql-42.3.8.jar:42.3.8]
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:408) ~[postgresql-42.3.8.jar:42.3.8]
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:329) ~[postgresql-42.3.8.jar:42.3.8]
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:315) ~[postgresql-42.3.8.jar:42.3.8]

Duplicate/related issues upstream.

TexasDigitalLibrary#1909
TexasDigitalLibrary#1904

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

No branches or pull requests

1 participant