Host comes with port
This commit is contained in:
parent
77667200ab
commit
4b295a45d4
|
@ -23,9 +23,8 @@ export function getOrgDomain(hostname: string) {
|
|||
return testHostname.endsWith(`.${ahn}`);
|
||||
});
|
||||
if (currentHostname) {
|
||||
const url = currentHostname.split(":");
|
||||
// Define which is the current domain/subdomain
|
||||
const slug = `${hostname}${url.length > 1 ? `:${url[1]}` : ""}`.replace(`.${currentHostname}` ?? "", "");
|
||||
const slug = hostname.replace(`.${currentHostname}` ?? "", "");
|
||||
return slug.indexOf(".") === -1 ? slug : null;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -35,13 +35,13 @@ describe("Org Domains Utils", () => {
|
|||
});
|
||||
|
||||
it("should handle a local web app with port url with a local subdomain hostname", () => {
|
||||
Object.defineProperty(constants, 'WEBAPP_URL', {value:"https://app.cal.local:3000"});
|
||||
expect(getOrgDomain("acme.cal.local")).toEqual("acme");
|
||||
Object.defineProperty(constants, 'WEBAPP_URL', {value:"http://app.cal.local:3000"});
|
||||
expect(getOrgDomain("acme.cal.local:3000")).toEqual("acme");
|
||||
});
|
||||
|
||||
it("should handle a local web app with port url with a non-local subdomain hostname", () => {
|
||||
Object.defineProperty(constants, 'WEBAPP_URL', {value:"https://app.cal.local:3000"});
|
||||
expect(getOrgDomain("acme.cal.com")).toEqual(null);
|
||||
Object.defineProperty(constants, 'WEBAPP_URL', {value:"http://app.cal.local:3000"});
|
||||
expect(getOrgDomain("acme.cal.com:3000")).toEqual(null);
|
||||
});
|
||||
})
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user