From a06f6bf074b2573ca0871f1373706199929b7b9d Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Tue, 22 Mar 2022 01:40:42 -0700 Subject: [PATCH] fix double slash in share link (#46757) (#46785) (cherry picked from commit 18c1c6ca6a0d0038856732222ab04cc4497faa0d) Co-authored-by: Santiago --- .../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 07a739eea6c..79489699844 100644 --- a/public/app/features/alerting/unified/components/rules/RuleDetailsActionButtons.tsx +++ b/public/app/features/alerting/unified/components/rules/RuleDetailsActionButtons.tsx @@ -61,8 +61,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];