ITADN

Escape quotes in advancedQuery regex literals

#6379Closedtheosanderson 创建于 2026-05-08
website
T
theosandersoncommented
**<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Escape quotes in advancedQuery regex literals** The new multi-field search builds `advancedQuery` by interpolating the user’s raw input into a single-quoted string (`${f}.regex='${regex}'`). `makeCaseInsensitiveLiteralSubstringRegex` escapes regex metacharacters but does not escape single quotes, so inputs containing apostrophes (e.g., “O'Connor”, “King’s College”) will terminate the string literal and produce a malformed `advancedQuery`, causing the search to fail or be parsed incorrectly. Please escape `'` (or switch to a safer encoding/quoting strategy) before embedding user input in the advanced query string. Useful? React with 👍 / 👎. _Originally posted by @chatgpt-codex-connector[bot] in https://github.com/loculus-project/loculus/pull/5881#discussion_r2741602060_
关闭于 2026-05-08 1 条评论