Autolinking doesn't work for TLDs longer than 4 characters

Description

Original report: https://github.com/mattermost/mattermost-server/issues/17025

Summary
The Markdown autolinking only works for TLDs up to 4 characters.
Even though there are many new TLDs with more than 4 characters, e.g. .africa, .computer, etc.
In fact TLDs can be as long as 63 characters.

Steps to reproduce
Repros on v5.31 and v5.32 at least.
Send a message with (see the Github issue for the correct formatting):

  • example.com/page

  • example.computer/page

Expected behavior
Both links are autolinked.

Observed behavior
Only the first link is autolinked since the TLD of the second link has more than 4 characters.

Possible fixes
Increase the autolink TLD limit to 63 characters or alternatively check the TLD against a list of all TLDs.

QA Test Steps

None

Mana

None

Assignee

Unassigned

QA Assignee

None

Reporter

Amy Blais

Epic Link

None

Fix versions

Mattermost Team

Web Platform

Sprint

None

Labels

QA Testing Areas

None

GitHub Issue

None

Components

None

Severity

None