From 5982d63dfb9b67812b7d9f757026dd89516cf506 Mon Sep 17 00:00:00 2001 From: Bryan Herbst Date: Mon, 2 Dec 2024 18:38:53 -0600 Subject: [PATCH] Strip double quotes from search queries (#986) --- .../androidclient/database/Database.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/thebluealliance/androidclient/database/Database.java b/android/src/main/java/com/thebluealliance/androidclient/database/Database.java index ef7e22e48..f8870f3a8 100644 --- a/android/src/main/java/com/thebluealliance/androidclient/database/Database.java +++ b/android/src/main/java/com/thebluealliance/androidclient/database/Database.java @@ -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); @@ -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); @@ -634,4 +636,8 @@ public Cursor getMatchesForEventQuery(String query) { } return cursor; } + + public String sanitizeQuery(String query) { + return query.replace("\"", ""); + } }