Kaynağa Gözat

Ignore hashtags that begin with a ampersand

Fixes #131

This is usually a marker of an HTML entity code.
It is possible for a user to do this on purpose,
but not horribly likely.

i hope
Derek Schmidt 7 yıl önce
ebeveyn
işleme
41683db2b4
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  1. 1 1
      app/Util/Lexer/Hashtag.php

+ 1 - 1
app/Util/Lexer/Hashtag.php

@@ -7,7 +7,7 @@ class Hashtag {
   public static function getHashtags($status)
   public static function getHashtags($status)
   {  
   {  
     $hashtags = false;  
     $hashtags = false;  
-    preg_match_all("/(#\w+)/u", $status, $matches);
+    preg_match_all("/(?<!&)(#\w+)/u", $status, $matches);
     if ($matches) {
     if ($matches) {
         $res = array_count_values($matches[0]);
         $res = array_count_values($matches[0]);
         $hashtags = array_keys($res);
         $hashtags = array_keys($res);