Files
outline/app/utils/isInternalUrl.js
Tom Moor f89eabaeff Hooks
2018-05-02 23:45:14 -07:00

13 lines
272 B
JavaScript

// @flow
export default function isInternalUrl(href: string) {
if (href[0] === '/') return true;
try {
const outline = new URL(BASE_URL);
const parsed = new URL(href);
return parsed.hostname === outline.hostname;
} catch (err) {
return false;
}
}