Skip to content

Commit

Permalink
Strip double quotes from search queries (#986)
Browse files Browse the repository at this point in the history
  • Loading branch information
bherbst authored Dec 3, 2024
1 parent b6a40ef commit 5982d63
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,9 @@ private SearchEvent() {
}

public Cursor getMatchesForTeamQuery(String query) {
String sanitizedQuery = sanitizeQuery(query);
String selection = SearchTeam.TITLES + " MATCH ?";
String[] selectionArgs = new String[]{query};
String[] selectionArgs = new String[]{sanitizedQuery};

SQLiteQueryBuilder builder = new SQLiteQueryBuilder();
builder.setTables(TABLE_SEARCH_TEAMS);
Expand All @@ -616,8 +617,9 @@ public Cursor getMatchesForTeamQuery(String query) {
}

public Cursor getMatchesForEventQuery(String query) {
String sanitizedQuery = sanitizeQuery(query);
String selection = SearchEvent.TITLES + " MATCH ?";
String[] selectionArgs = new String[]{query};
String[] selectionArgs = new String[]{sanitizedQuery};

SQLiteQueryBuilder builder = new SQLiteQueryBuilder();
builder.setTables(TABLE_SEARCH_EVENTS);
Expand All @@ -634,4 +636,8 @@ public Cursor getMatchesForEventQuery(String query) {
}
return cursor;
}

public String sanitizeQuery(String query) {
return query.replace("\"", "");
}
}

0 comments on commit 5982d63

Please sign in to comment.