Skip to content

Commit bcad742

Browse files
committed
Avoid double slash in block explorer links
The Etherscan base URLs in `chains.ts` carry a trailing slash, so every Ethereum link rendered as `etherscan.io//address/...`. Browsers tolerate it, but the acreBTC and withdrawal queue links in the vault details modal are specified without it. Normalises the prefix in `createBlockExplorerLink` so all chains are handled the same way.
1 parent 6be24ce commit bcad742

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

dapp/src/utils/chainUtils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ import { Chain, ExplorerDataType } from "#/types"
66
// However, it provides us with an easy way
77
// to handle the next data for block explorer.
88
const createBlockExplorerLink = (
9-
prefix: string,
9+
rawPrefix: string,
1010
id: string,
1111
type: ExplorerDataType,
1212
) => {
13+
// Some explorer base URLs carry a trailing slash, which would otherwise
14+
// produce a double slash in the resulting link.
15+
const prefix = rawPrefix.replace(/\/+$/, "")
16+
1317
switch (type) {
1418
case "address":
1519
return `${prefix}/address/${id}`

0 commit comments

Comments
 (0)