From 14fe53e1506b1ecbccfe16ff98105f30bf79c204 Mon Sep 17 00:00:00 2001 From: Viktor Avelino <64113566+viktoravelino@users.noreply.github.com> Date: Tue, 14 Apr 2026 18:07:49 -0400 Subject: [PATCH] feat: add customOpenUrl utility for secure external link handling (#12705) * feat: add customOpenUrl utility for secure external link handling Extract window.open with noopener/noreferrer into a reusable customization utility and use it in ProviderConfigurationForm. Also converts to type-only imports where applicable. * fix: use existing function * fix: use custom open tab function --- .../components/ProviderConfigurationForm.tsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/frontend/src/modals/modelProviderModal/components/ProviderConfigurationForm.tsx b/src/frontend/src/modals/modelProviderModal/components/ProviderConfigurationForm.tsx index b80278e97e..7d8fbd37f7 100644 --- a/src/frontend/src/modals/modelProviderModal/components/ProviderConfigurationForm.tsx +++ b/src/frontend/src/modals/modelProviderModal/components/ProviderConfigurationForm.tsx @@ -4,10 +4,11 @@ import ShadTooltip from "@/components/common/shadTooltipComponent"; import MultiselectComponent from "@/components/core/parameterRenderComponent/components/multiselectComponent"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; -import { ProviderVariable } from "@/constants/providerConstants"; +import type { ProviderVariable } from "@/constants/providerConstants"; +import { customOpenNewTab } from "@/customization/utils/custom-open-new-tab"; import useAlertStore from "@/stores/alertStore"; import DisconnectWarning from "./DisconnectWarning"; -import { Provider } from "./types"; +import type { Provider } from "./types"; const PROVIDER_KEY_PREVIEW: Record< string, @@ -145,11 +146,7 @@ const ProviderConfigurationForm = ({ className="underline cursor-pointer hover:text-primary" onClick={() => { if (selectedProvider.api_docs_url) { - window.open( - selectedProvider.api_docs_url, - "_blank", - "noopener,noreferrer", - ); + customOpenNewTab(selectedProvider.api_docs_url); } }} >