From: James Moger Date: Thu, 4 Sep 2014 19:16:02 +0000 (-0400) Subject: Quote all Lucene query args that have non-alphanumeric characters X-Git-Tag: v1.6.1~52^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Ftickets%2F53%2F153%2F1;p=gitblit.git Quote all Lucene query args that have non-alphanumeric characters --- 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;