diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-08-01 18:13:08 +0200 |
---|---|---|
committer | ThibG <thib@sitedethib.com> | 2019-08-04 22:25:56 +0200 |
commit | 76b80a15119b5fbe19ec8b3329616c955a1e5af4 (patch) | |
tree | 4c756696c53ba6eb2f47e0c1aaf766786a6606ee /app | |
parent | 43b137e1f91a5cbe42e16b9cc9db7fdbe5d01099 (diff) |
Perform case-insensitive comparison for international domain names
Note: this uses `toLowerCase()` instead of doing proper case folding
Diffstat (limited to 'app')
-rw-r--r-- | app/javascript/flavours/glitch/components/status_content.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/components/status_content.js b/app/javascript/flavours/glitch/components/status_content.js index e51cc8fd5..147c1d1b1 100644 --- a/app/javascript/flavours/glitch/components/status_content.js +++ b/app/javascript/flavours/glitch/components/status_content.js @@ -65,10 +65,11 @@ const isLinkMisleading = (link, checkUrlLike = true) => { } // The link hasn't been recognized, maybe it features an international domain name - const hostname = decodeIDNA(targetURL.hostname); + const hostname = decodeIDNA(targetURL.hostname).normalize('NFKC'); const host = targetURL.host.replace(targetURL.hostname, hostname); const origin = targetURL.origin.replace(targetURL.host, host); - if (textMatchesTarget(linkText, origin, host)) { + const text = linkText.normalize('NFKC'); + if (textMatchesTarget(text, origin, host) || textMatchesTarget(text.toLowerCase(), origin, host)) { return false; } |