From 18c1c6ca6a0d0038856732222ab04cc4497faa0d Mon Sep 17 00:00:00 2001 From: Santiago Date: Mon, 21 Mar 2022 11:00:54 -0300 Subject: [PATCH] fix double slash in share link (#46757) --- .../unified/components/rules/RuleDetailsActionButtons.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/app/features/alerting/unified/components/rules/RuleDetailsActionButtons.tsx b/public/app/features/alerting/unified/components/rules/RuleDetailsActionButtons.tsx index 1b36cccf071..aeca2d94e40 100644 --- a/public/app/features/alerting/unified/components/rules/RuleDetailsActionButtons.tsx +++ b/public/app/features/alerting/unified/components/rules/RuleDetailsActionButtons.tsx @@ -62,8 +62,10 @@ export const RuleDetailsActionButtons: FC = ({ rule, rulesSource }) => { const buildShareUrl = () => { if (isCloudRulesSource(rulesSource)) { + const { appUrl, appSubUrl } = config; + const baseUrl = appSubUrl !== '' ? `${appUrl}${appSubUrl}/` : config.appUrl; const ruleUrl = `${encodeURIComponent(rulesSource.name)}/${encodeURIComponent(rule.name)}`; - return `${config.appUrl}${config.appSubUrl}/alerting/${ruleUrl}/find`; + return `${baseUrl}alerting/${ruleUrl}/find`; } return window.location.href.split('?')[0];