diff options
author | Mostafa Ahangarha <ahangarha@users.noreply.github.com> | 2019-09-05 01:00:49 +0430 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2019-09-04 22:30:49 +0200 |
commit | e974d4923fabd887416609bc6c8ca81ce81d0ff2 (patch) | |
tree | f7d302d31ec4bbc7da91ce01e2808c7dbf8fa527 | |
parent | bdca8da8ebb133f9f2a01cd4881a2fc3f6852274 (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
-rw-r--r-- | app/javascript/mastodon/rtl.js | 1 |
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); |