This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/app/utils/isInternalUrl.js

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;
}
}