usePullRequestParam: Provisioned dashboard preview banner, decode pull request url before sanitize (#114516)
usePullRequestParam: decode url before sanitize
This commit is contained in:
@@ -107,9 +107,14 @@ export function PreviewBannerViewPR({ prParam, isNewPr, behindBranch, repoUrl, b
|
||||
{/* when repo type is not local, we show branch information */}
|
||||
{showBranchInfo(repoType, branchInfo) && (
|
||||
<Box marginTop={1}>
|
||||
<Trans i18nKey="provisioned-resource-preview-banner.preview-banner.branch-text">branch: </Trans>
|
||||
<TextLink href={getBranchUrl(repoBaseUrl!, targetBranch!, repoType)}>{targetBranch}</TextLink> {'\u2192'}{' '}
|
||||
<TextLink href={getBranchUrl(repoBaseUrl!, configuredBranch!, repoType)}>{configuredBranch}</TextLink>
|
||||
<Trans i18nKey="provisioned-resource-preview-banner.preview-banner.branch-text">branch:</Trans>{' '}
|
||||
<TextLink href={getBranchUrl(repoBaseUrl!, targetBranch!, repoType)} external>
|
||||
{targetBranch}
|
||||
</TextLink>{' '}
|
||||
{'\u2192'}{' '}
|
||||
<TextLink href={getBranchUrl(repoBaseUrl!, configuredBranch!, repoType)} external>
|
||||
{configuredBranch}
|
||||
</TextLink>
|
||||
</Box>
|
||||
)}
|
||||
</Alert>
|
||||
|
||||
@@ -9,9 +9,9 @@ export const usePullRequestParam = () => {
|
||||
const repoType = params.get('repo_type');
|
||||
|
||||
return {
|
||||
prURL: prParam ? textUtil.sanitizeUrl(prParam) : undefined,
|
||||
newPrURL: newPrParam ? textUtil.sanitizeUrl(newPrParam) : undefined,
|
||||
repoURL: repoUrl ? textUtil.sanitizeUrl(repoUrl) : undefined,
|
||||
repoType: repoType ? textUtil.sanitizeUrl(repoType) : undefined,
|
||||
prURL: prParam ? textUtil.sanitizeUrl(decodeURIComponent(prParam)) : undefined,
|
||||
newPrURL: newPrParam ? textUtil.sanitizeUrl(decodeURIComponent(newPrParam)) : undefined,
|
||||
repoURL: repoUrl ? textUtil.sanitizeUrl(decodeURIComponent(repoUrl)) : undefined,
|
||||
repoType: repoType ? textUtil.sanitizeUrl(decodeURIComponent(repoType)) : undefined,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user