Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlexanderKolberg
Copy link
Member

The rootUrl already contains an ending /

@AlexanderKolberg AlexanderKolberg requested a review from a team as a code owner December 11, 2024 06:54
@@ -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}`

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/..

Copy link
Member Author

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rootUrl.replace(/\/+$/, ''); ?

Copy link
Collaborator

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

Copy link
Collaborator

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, '/')
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants