From 276197083ab83c595d7d733cc1ee88e90eec08eb Mon Sep 17 00:00:00 2001 From: sergeyteleshev Date: Fri, 13 Dec 2024 17:11:17 +0100 Subject: [PATCH] CB-5955 pr fixes --- .../src/NavTree/getFolderPathWithProjectId.ts | 6 ++++++ .../src/CustomConnectionPluginBootstrap.ts | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/webapp/packages/core-connections/src/NavTree/getFolderPathWithProjectId.ts b/webapp/packages/core-connections/src/NavTree/getFolderPathWithProjectId.ts index f5908e1e77..8836dc85ee 100644 --- a/webapp/packages/core-connections/src/NavTree/getFolderPathWithProjectId.ts +++ b/webapp/packages/core-connections/src/NavTree/getFolderPathWithProjectId.ts @@ -5,6 +5,12 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import { isFolderNodeId } from './isFolderNodeId.js'; + export function getFolderPathWithProjectId(folderId: string): string { + if (!isFolderNodeId(folderId)) { + throw new Error('Invalid folder id'); + } + return folderId.replace('folder://', ''); } diff --git a/webapp/packages/plugin-connection-custom/src/CustomConnectionPluginBootstrap.ts b/webapp/packages/plugin-connection-custom/src/CustomConnectionPluginBootstrap.ts index 51808e755b..659e686efa 100644 --- a/webapp/packages/plugin-connection-custom/src/CustomConnectionPluginBootstrap.ts +++ b/webapp/packages/plugin-connection-custom/src/CustomConnectionPluginBootstrap.ts @@ -78,10 +78,9 @@ export class CustomConnectionPluginBootstrap extends Bootstrap { } private async createConnectionHandler(context: IDataContextProvider, action: IAction) { - const tree = context.get(DATA_CONTEXT_ELEMENTS_TREE)!; - switch (action) { case ACTION_TREE_CREATE_CONNECTION: { + const tree = context.get(DATA_CONTEXT_ELEMENTS_TREE)!; const projectId = this.treeSelectionService.getSelectedProject(tree)?.id; const selectedNode = this.treeSelectionService.getFirstSelectedNode(tree, getProjectNodeId); const folderPath = selectedNode?.folderId ? getFolderPath(selectedNode.folderId) : undefined;