Restrict internal links to the same host only

A zulip service is hosted with a particular hostname and not across a
whole domain. Internal links should respect this otherwise links to other
distinct services hosted under the same domain will be loaded by the app
and not in a separate browser window.
This commit is contained in:
James Steele
2016-09-10 13:33:15 +01:00
parent 5cc3bf0dc8
commit 39f3df5b8f

View File

@@ -2,8 +2,8 @@ const wurl = require('wurl');
// Check link if it's internal/external
function linkIsInternal(currentUrl, newUrl) {
const currentDomain = wurl('domain', currentUrl);
const newDomain = wurl('domain', newUrl);
const currentDomain = wurl('hostname', currentUrl);
const newDomain = wurl('hostname', newUrl);
return currentDomain === newDomain;
}