Description
When using common characters such as apostrophes (') and others, the search fails and throws a SQL error.
SQLite: near "s": syntax error
Sorry about that. A report has been filed. Please try a different search.
Repro
- Open https://transcript.fish
- Search "heaven's gate"
- See error
Screenshots
Additional info
The actual query gets created here.
const searchEpisodeWordsQuery = (searchTerm: string) => `
SELECT
episode
FROM
words_fts
WHERE
words_fts MATCH '${searchTerm}'
`;
https://github.com/noman-land/transcript.fish/blob/master/src/js/database/queries.ts#L138-L145
It seems this needs to be a prepared statement instead string concat but I couldn't solve this the first time I tried.