-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(is_external_link): handle invalid url #183
Conversation
According to travis ci build, no performance impact detected. |
Since it is a widely used packages on npm so I believe it is reliable enough. |
d99e87b
to
0ace953
Compare
0ace953
to
2a9a5ba
Compare
let data; | ||
try { | ||
data = new URL(input, `http://${sitehost}`); | ||
} catch (e) { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about hexo.log.warn(...)
to alert the user that there has an invalid URL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since hexo-util has no hexo-log
's dependency, there is no way we can use hexo.log.warn
in hexo-util.
Details can be found at hexojs/hexo#4130
This PR introduce a try block and treat invalid URL as internal link (return
false
).