about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorMostafa Ahangarha <ahangarha@users.noreply.github.com>2019-09-05 01:00:49 +0430
committerEugen Rochko <eugen@zeonfederated.com>2019-09-04 22:30:49 +0200
commite974d4923fabd887416609bc6c8ca81ce81d0ff2 (patch)
treef7d302d31ec4bbc7da91ce01e2808c7dbf8fa527 /app
parentbdca8da8ebb133f9f2a01cd4881a2fc3f6852274 (diff)
Exclude URLs from text analysis (#11759)
By the added regex, URLs, including the one without http or even www
like mysite.com will be removed from the toot's body so only the real
text of the toot will be analyzed for RTL detection
Diffstat (limited to 'app')
-rw-r--r--app/javascript/mastodon/rtl.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/javascript/mastodon/rtl.js b/app/javascript/mastodon/rtl.js
index 00870a15d..89bed6de8 100644
--- a/app/javascript/mastodon/rtl.js
+++ b/app/javascript/mastodon/rtl.js
@@ -20,6 +20,7 @@ export function isRtl(text) {
   text = text.replace(/(?:^|[^\/\w])@([a-z0-9_]+(@[a-z0-9\.\-]+)?)/ig, '');
   text = text.replace(/(?:^|[^\/\w])#([\S]+)/ig, '');
   text = text.replace(/\s+/g, '');
+  text = text.replace(/(\w\S+\.\w{2,}\S*)/g, '');
 
   const matches = text.match(rtlChars);