1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Update isLocal logic to enforce protocol and port (#1737)

This commit is contained in:
Kuan 2017-04-22 06:07:36 -07:00 committed by Tim Neutkens
parent 9ed387ad26
commit fb0b7534d7

View file

@ -129,8 +129,8 @@ export default class Link extends Component {
function isLocal (href) { function isLocal (href) {
const url = parse(href, false, true) const url = parse(href, false, true)
const origin = parse(getLocationOrigin(), false, true) const origin = parse(getLocationOrigin(), false, true)
return (!url.host || !url.hostname) || return !url.host ||
(origin.host === url.host || origin.hostname === url.hostname) (url.protocol === origin.protocol && url.host === origin.host)
} }
const warnLink = execOnce(warn) const warnLink = execOnce(warn)