-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove extra slash in blockexporer url #214
base: master
Are you sure you want to change the base?
Conversation
@@ -82,7 +82,7 @@ export const TransactionStatus = () => { | |||
onError | |||
} = transactionStatusSettings! | |||
const networkConfig = findSupportedNetwork(chainId) | |||
const blockExplorerUrl = `${networkConfig?.blockExplorer?.rootUrl}/tx/${txHash}` | |||
const blockExplorerUrl = `${networkConfig?.blockExplorer?.rootUrl}tx/${txHash}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd expect rootUrl
not to have the trailing slash. And this path would stay the same /txt/..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, that it shouldn't be there... But removing it is a breaking change that will break a bunch of applications
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rootUrl.replace(/\/+$/, '');
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should create a small pathJoin utility to handle these cases then we don't need to care
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export function join(...paths: string[]): string {
return paths
.map(path => path.trim())
.filter(Boolean)
.join('/')
.replace(/(?<!:)\/{2,}/g, '/')
}
The rootUrl already contains an ending
/