* fix(integrations): preserve Nextcloud subpaths * Keep existing Nextcloud DAV endpoints intact --------- Co-authored-by: Artur <145776561+arturict@users.noreply.github.com> Co-authored-by: arturict <arturict@users.noreply.github.com>
14 lines
482 B
TypeScript
14 lines
482 B
TypeScript
export const createNextcloudCalendarServerUrl = (integrationUrl: string) => {
|
|
const calendarServerUrl = new URL(integrationUrl);
|
|
const integrationPath = calendarServerUrl.pathname.replace(/\/+$/, "");
|
|
const davPath = "/remote.php/dav";
|
|
|
|
calendarServerUrl.pathname = integrationPath.endsWith(davPath)
|
|
? `${integrationPath}/`
|
|
: `${integrationPath}${davPath}/`;
|
|
calendarServerUrl.search = "";
|
|
calendarServerUrl.hash = "";
|
|
|
|
return calendarServerUrl.toString();
|
|
};
|