Surprisingly, if company-uri:invoice/5 is the only thing in the message, it does get turned into the correct link, but if there is anything before it (such as blah company_uri:invoice/5), it doesn’t. Since my company has a number in the URI scheme, I also noticed this related issue with how Markdown links work: https://github.com/mattermost/mattermost-server/issues/7405
I am not sure why the : does that, nor if that could be a bug, it depends on why it parses : strings with no separators, I will try asking the devs. Because the regex that parses links, is slightly different.
OK, found it, it was indeed related to links for the issue with the numbers in the first part of your text:
The regex doesn’t take into consideration numbers thus it fails as you described and adds the http:// to it.
As for your initial issue I am not very sure yet, still looking.