jenkins-bot has submitted this change and it was merged.

Change subject: Escape multiple range operators in a row
......................................................................


Escape multiple range operators in a row

You used to be able to sneak a range query in by repeating it like >>s to
match all tokens after s.

Change-Id: Iabf1b36b6cc3c9ff54489b966ef50b3f8c7896af
---
M includes/Search/Escaper.php
M tests/browser/features/bad_syntax.feature
2 files changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Chad: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Search/Escaper.php b/includes/Search/Escaper.php
index 3a97a6a..06cf51e 100644
--- a/includes/Search/Escaper.php
+++ b/includes/Search/Escaper.php
@@ -96,7 +96,7 @@
                $string = preg_replace( '/(?<![\w])([?*])/u', '', $string );
 
                // Reduce token ranges to bare tokens without the < or >
-               $string = preg_replace( '/(?:<|>)([^\s])/u', '$1', $string );
+               $string = preg_replace( '/(?:<|>)+([^\s])/u', '$1', $string );
 
                // Turn bad fuzzy searches into searches that contain a ~ and 
set $this->fuzzyQuery for good ones.
                $fuzzyQuery = false;
diff --git a/tests/browser/features/bad_syntax.feature 
b/tests/browser/features/bad_syntax.feature
index 2c08285..acb845a 100644
--- a/tests/browser/features/bad_syntax.feature
+++ b/tests/browser/features/bad_syntax.feature
@@ -146,6 +146,10 @@
     | <     |
     | >>    |
     | <>    |
+    | <>=   |
+    | >>>   |
+    | <<<   |
+    | <<<~  |
 
   @filters
   Scenario Outline: Empty filters work like terms but aren't in test data so 
aren't found

-- 
To view, visit https://gerrit.wikimedia.org/r/175124
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iabf1b36b6cc3c9ff54489b966ef50b3f8c7896af
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to