Skip to content

Commit f58e7e7

Browse files
authored
check origin only if it doesn't have 'null' value, meaning the text doesn't have a recognized protocol (#2714)
1 parent d386200 commit f58e7e7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/url.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ export function isMisleadingLink (text, href) {
267267

268268
try {
269269
const textUrl = new URL(text)
270-
if (textUrl.origin !== hrefUrl.origin) {
270+
// if textUrl.origin has value 'null', it means the text is not trying to be a URL
271+
if (textUrl.origin !== 'null' && textUrl.origin !== hrefUrl.origin) {
271272
misleading = true
272273
}
273274
} catch {}

0 commit comments

Comments
 (0)