From a4fa1b996be8641aa5c89375ee78cc6eb70a7c76 Mon Sep 17 00:00:00 2001 From: James Moger Date: Thu, 4 Sep 2014 15:16:02 -0400 Subject: [PATCH] Quote all Lucene query args that have non-alphanumeric characters --- src/main/java/com/gitblit/tickets/TicketIndexer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gitblit/tickets/TicketIndexer.java b/src/main/java/com/gitblit/tickets/TicketIndexer.java index 98fe6977..11ea3a73 100644 --- a/src/main/java/com/gitblit/tickets/TicketIndexer.java +++ b/src/main/java/com/gitblit/tickets/TicketIndexer.java @@ -143,8 +143,10 @@ public class TicketIndexer { private String escape(String value) { if (value.charAt(0) != '"') { - if (value.indexOf('/') > -1 || value.indexOf('-') > -1) { - return "\"" + value + "\""; + for (char c : value.toCharArray()) { + if (!Character.isLetterOrDigit(c)) { + return "\"" + value + "\""; + } } } return value; -- 2.39.5