fix inline player not showing up broken from previous commit

This commit is contained in:
Sean Yesmunt 2020-10-22 18:09:17 -04:00
parent c9fdaec997
commit 221ae5b821

View file

@ -40,14 +40,15 @@ function MarkdownLink(props: Props) {
const protocolRegex = new RegExp('^(https?|lbry|mailto)+:', 'i');
const protocol = href ? protocolRegex.exec(href) : null;
// Return plain text if no valid url
// Return external link if protocol is http or https
// Return local link if protocol is lbry uri
if (!simpleLinks && protocol && protocol[0] === 'lbry:' && isURIValid(decodedUri)) {
const linkUrlObject = new URL(decodedUri);
let linkUrlObject;
try {
linkUrlObject = new URL(decodedUri);
} catch (e) {}
let lbryUrlFromLink;
if (linkUrlObject) {
const linkDomain = linkUrlObject.host;
const isKnownAppDomainLink = KNOWN_APP_DOMAINS.includes(linkDomain);
let lbryUrlFromLink;
if (isKnownAppDomainLink) {
const linkPathname = decodeURIComponent(
linkUrlObject.pathname.startsWith('//') ? linkUrlObject.pathname.slice(2) : linkUrlObject.pathname.slice(1)
@ -58,7 +59,12 @@ function MarkdownLink(props: Props) {
lbryUrlFromLink = possibleLbryUrl;
}
}
}
// Return plain text if no valid url
// Return external link if protocol is http or https
// Return local link if protocol is lbry uri
if ((protocol && protocol[0] === 'lbry:' && isURIValid(decodedUri)) || lbryUrlFromLink) {
element = (
<ClaimLink
uri={lbryUrlFromLink || decodedUri}