mirror of
https://github.com/outline/outline.git
synced 2025-12-30 07:19:52 -06:00
fix: Internal URL detection on client, closes #7245
This commit is contained in:
@@ -59,6 +59,10 @@ describe("isInternalUrl", () => {
|
||||
expect(urlsUtils.isInternalUrl("https://example.com:4000")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false if port is missing", () => {
|
||||
expect(urlsUtils.isInternalUrl("https://example.com")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return true if starting with relative path", () => {
|
||||
expect(urlsUtils.isInternalUrl("/drafts")).toEqual(true);
|
||||
});
|
||||
|
||||
@@ -37,7 +37,9 @@ export function isInternalUrl(href: string) {
|
||||
|
||||
return (
|
||||
(outline.host === domain.host && outline.port === domain.port) ||
|
||||
(typeof window !== "undefined" && window.location.hostname === domain.host)
|
||||
(typeof window !== "undefined" &&
|
||||
window.location.hostname === domain.host &&
|
||||
window.location.port === domain.port)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user