mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 11:35:24 +01:00
Check if token is a valid column name in the fts table before treating it as such.
This commit is contained in:
parent
827ed9425c
commit
3f4e8e5b88
@ -48,11 +48,24 @@ LibraryQuery::LibraryQuery(const QueryOptions& options)
|
||||
token.remove(')');
|
||||
token.remove('"');
|
||||
|
||||
if (token.contains(':'))
|
||||
query += "fts" + token + "* ";
|
||||
else
|
||||
if (token.contains(':')) {
|
||||
// Only prefix fts if the token is a valid column name.
|
||||
if (Song::kFtsColumns.contains("fts" + token.section(':', 0, 0),
|
||||
Qt::CaseInsensitive)) {
|
||||
// Account for multiple colons.
|
||||
QString columntoken = token.section(
|
||||
':', 0, 0, QString::SectionIncludeTrailingSep);
|
||||
QString subtoken = token.section(':', 1, -1);
|
||||
subtoken.replace(":", " ");
|
||||
query += "fts" + columntoken + subtoken + "* ";
|
||||
} else {
|
||||
token.replace(':', 1, ' ');
|
||||
query += token + "* ";
|
||||
}
|
||||
} else {
|
||||
query += token + "* ";
|
||||
}
|
||||
}
|
||||
|
||||
where_clauses_ << "fts.%fts_table_noprefix MATCH ?";
|
||||
bound_values_ << query;
|
||||
|
Loading…
x
Reference in New Issue
Block a user