From 9ef36942eb3e2ce96a27eed6974f6c44b1adc546 Mon Sep 17 00:00:00 2001 From: sergeyteleshev Date: Wed, 2 Oct 2024 18:19:47 +0200 Subject: [PATCH] CB-5578 sends server url without protocol while custom certificate deletion --- webapp/packages/core-utils/src/index.ts | 1 + .../packages/core-utils/src/removeProtocolFromUrl.ts | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 webapp/packages/core-utils/src/removeProtocolFromUrl.ts diff --git a/webapp/packages/core-utils/src/index.ts b/webapp/packages/core-utils/src/index.ts index 9344e0c195..74ebef5a7b 100644 --- a/webapp/packages/core-utils/src/index.ts +++ b/webapp/packages/core-utils/src/index.ts @@ -15,6 +15,7 @@ export * from './Quadtree/index.js'; export * from './underscore.js'; +export * from './removeProtocolFromUrl.js'; export * from './emptyConstants.js'; export * from './base64ToBlob.js'; export * from './blobToBase64.js'; diff --git a/webapp/packages/core-utils/src/removeProtocolFromUrl.ts b/webapp/packages/core-utils/src/removeProtocolFromUrl.ts new file mode 100644 index 0000000000..21c91f377f --- /dev/null +++ b/webapp/packages/core-utils/src/removeProtocolFromUrl.ts @@ -0,0 +1,10 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ +export function removeProtocolFromUrl(url: string): string { + return url.replace(/(^\w+:|^)\/\//, ''); +}