Improve handling for URLs composed of mixed character sets

This commit is contained in:
Scott Nonnenberg 2019-02-21 12:28:13 -08:00
parent e4b0901620
commit ae2db9f09a
6 changed files with 185 additions and 1 deletions

View file

@ -3,6 +3,7 @@ import React from 'react';
import LinkifyIt from 'linkify-it';
import { RenderTextCallback } from '../../types/Util';
import { isLinkSneaky } from '../../../js/modules/link_previews';
const linkify = LinkifyIt();
@ -49,7 +50,7 @@ export class Linkify extends React.Component<Props> {
}
const { url, text: originalText } = match;
if (SUPPORTED_PROTOCOLS.test(url)) {
if (SUPPORTED_PROTOCOLS.test(url) && !isLinkSneaky(url)) {
results.push(
<a key={count++} href={url}>
{originalText}