From 1fd2e88bf694ebe15ebdf9f42e27407f8c005bc0 Mon Sep 17 00:00:00 2001 From: Aubin Date: Thu, 16 Jan 2025 15:47:40 +0100 Subject: [PATCH] add a function getConfluenceSpaceUrl --- .../src/connectors/confluence/lib/permissions.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/connectors/src/connectors/confluence/lib/permissions.ts b/connectors/src/connectors/confluence/lib/permissions.ts index 48ac475a6873..73c7e698ea2e 100644 --- a/connectors/src/connectors/confluence/lib/permissions.ts +++ b/connectors/src/connectors/confluence/lib/permissions.ts @@ -34,15 +34,22 @@ function isConfluenceSpaceModel( ); } +export function getConfluenceSpaceUrl( + space: ConfluenceSpace | ConfluenceSpaceType, + baseUrl: string +) { + const urlSuffix = isConfluenceSpaceModel(space) + ? space.urlSuffix + : space._links.webui; + return `${baseUrl}/wiki${urlSuffix}`; +} + export function createContentNodeFromSpace( space: ConfluenceSpace | ConfluenceSpaceType, baseUrl: string, permission: ConnectorPermission, { isExpandable }: { isExpandable: boolean } ): ContentNode { - const urlSuffix = isConfluenceSpaceModel(space) - ? space.urlSuffix - : space._links.webui; const spaceId = isConfluenceSpaceModel(space) ? space.spaceId : space.id; return { @@ -50,7 +57,7 @@ export function createContentNodeFromSpace( parentInternalId: null, type: "folder", title: space.name || "Unnamed Space", - sourceUrl: `${baseUrl}/wiki${urlSuffix}`, + sourceUrl: getConfluenceSpaceUrl(space, baseUrl), expandable: isExpandable, permission, lastUpdatedAt: null,