handle malformed markdown links
This commit is contained in:
parent
505bae77ac
commit
c822f1702f
1 changed files with 6 additions and 2 deletions
|
@ -18,9 +18,13 @@ type Props = {
|
|||
|
||||
function MarkdownLink(props: Props) {
|
||||
const { children, href, title, embed = false, parentCommentId, isMarkdownPost, simpleLinks = false } = props;
|
||||
const decodedUri = decodeURI(href);
|
||||
|
||||
if (!href) {
|
||||
let decodedUri;
|
||||
try {
|
||||
decodedUri = decodeURI(href);
|
||||
} catch (e) {}
|
||||
|
||||
if (!href || !decodedUri) {
|
||||
return children || null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue