Files
calendar/packages/lib/getTldPlus1.ts
T
Dhairyashil ShindeandGitHub bea542b310 fix: correct bookingUrl for EU instance in API responses (#27046)
* fix: use WEBAPP_URL for booking URLs when domains differ

For EU deployments where WEBAPP_URL (app.cal.eu) differs from
WEBSITE_URL (cal.com), use WEBAPP_URL for non-org booking URLs.
This fixes incorrect bookingUrl in API responses for EU instance.

* Created new shared utility getTldPlus1 and updated code to use shared function instead of inline copy

* use same comment
2026-01-20 12:48:30 +00:00

8 lines
346 B
TypeScript

/**
* Note: It doesn't support multipart tlds like .co.uk and thus makes only one part tld's safe like .com(and thus cal.com)
* If we want to use it elsewhere as well(apart from embed/preview.ts) we must consider Public Suffix List
*/
export function getTldPlus1(hostname: string): string {
return hostname.split(".").slice(-2).join(".");
}