]> source.dussan.org Git - gitblit.git/commitdiff
Quote all Lucene query args that have non-alphanumeric characters 53/153/1
authorJames Moger <james.moger@gitblit.com>
Thu, 4 Sep 2014 19:16:02 +0000 (15:16 -0400)
committerJames Moger <james.moger@gitblit.com>
Thu, 4 Sep 2014 19:16:02 +0000 (15:16 -0400)
src/main/java/com/gitblit/tickets/TicketIndexer.java

index 98fe69776fd2be2c0d53db69f1251226a30f997a..11ea3a738ef774a700ebe24f12154d49ac7e2a08 100644 (file)
@@ -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;