Skip to content

Commit 63037f1

Browse files
fix: ensure valid block explorer URL for address links (#5061)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on updating the `href` attribute in the `metadata-header.tsx` file to ensure that the URL for the block explorer correctly appends the address, handling cases where the URL may or may not end with a trailing slash. ### Detailed summary - Modified the `href` attribute to check if `validBlockExplorer.url` ends with a `/`. - If it does not, a `/` is added before appending `address/${address}`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent b205f1d commit 63037f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apps/dashboard/src/components/custom-contract/contract-header/metadata-header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export const MetadataHeader: React.FC<MetadataHeaderProps> = ({
117117
<BadgeLink
118118
key={validBlockExplorer.url}
119119
name={validBlockExplorer.name}
120-
href={`${validBlockExplorer.url}/address/${address}`}
120+
href={`${validBlockExplorer.url.endsWith("/") ? validBlockExplorer.url : `${validBlockExplorer.url}/`}address/${address}`}
121121
/>
122122
))}
123123

0 commit comments

Comments
 (0)