about summary refs log tree commit diff
diff options
context:
space:
mode:
authorunarist <m.unarist@gmail.com>2017-09-19 04:25:40 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-09-18 21:25:40 +0200
commit6db034a866b78e4e98b122461ca84763f0104381 (patch)
tree13528de199ceacfd2661fb0f66a118bc979334fb
parent17bf3363ac600b72755167f82e059feb4fbffa87 (diff)
Re-allow underscore on valid_url_path_ending_chars (#4999)
Limiting allowed characters in the last character of the URL is came from twitter-text, but underscore is allowed on there, and Mastodon before #4941.
-rw-r--r--app/javascript/mastodon/features/compose/util/url_regex.js2
-rw-r--r--config/initializers/twitter_regex.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/javascript/mastodon/features/compose/util/url_regex.js b/app/javascript/mastodon/features/compose/util/url_regex.js
index c15b9696a..e676d1879 100644
--- a/app/javascript/mastodon/features/compose/util/url_regex.js
+++ b/app/javascript/mastodon/features/compose/util/url_regex.js
@@ -172,7 +172,7 @@ export const urlRegex = (function() {
   , 'i');
   // Valid end-of-path chracters (so /foo. does not gobble the period).
   // 1. Allow =&# for empty URL parameters and other URL-join artifacts
-  regexen.validUrlPathEndingChars = regexSupplant(/[^#{spaces_group}\(\)\?!\*';:=\,\.\$%\[\]#{pd}_~&\|@]|(?:#{validUrlBalancedParens})/i);
+  regexen.validUrlPathEndingChars = regexSupplant(/[^#{spaces_group}\(\)\?!\*';:=\,\.\$%\[\]#{pd}~&\|@]|(?:#{validUrlBalancedParens})/i);
   // Allow @ in a url, but only in the middle. Catch things like http://example.com/@user/
   regexen.validUrlPath = regexSupplant('(?:' +
     '(?:' +
diff --git a/config/initializers/twitter_regex.rb b/config/initializers/twitter_regex.rb
index 5a0723d24..e924fac22 100644
--- a/config/initializers/twitter_regex.rb
+++ b/config/initializers/twitter_regex.rb
@@ -2,7 +2,7 @@ module Twitter
   class Regex
 
     REGEXEN[:valid_general_url_path_chars] = /[^\p{White_Space}\(\)\?]/iou
-    REGEXEN[:valid_url_path_ending_chars] = /[^\p{White_Space}\(\)\?!\*';:=\,\.\$%\[\]\p{Pd}_~&\|@]|(?:#{REGEXEN[:valid_url_balanced_parens]})/iou
+    REGEXEN[:valid_url_path_ending_chars] = /[^\p{White_Space}\(\)\?!\*';:=\,\.\$%\[\]\p{Pd}~&\|@]|(?:#{REGEXEN[:valid_url_balanced_parens]})/iou
     REGEXEN[:valid_url_balanced_parens] = /
       \(
         (?: