Skip to content

fix(ens): strip trailing slash from custom Arweave gateway when rewriting arweave.net avatar URLs - #5600

Closed
mortezashojaei wants to merge 1 commit into
wevm:mainfrom
mortezashojaei:fix/ens-avatar-arweave-gateway-slash
Closed

mortezashojaei wants to merge 1 commit into
wevm:mainfrom
mortezashojaei:fix/ens-avatar-arweave-gateway-slash

Conversation

@mortezashojaei

Copy link
Copy Markdown
Contributor

resolveAvatarUri uses getGateway to strip a trailing slash from custom gateways, but the branch that rewrites https://arweave.net/... URLs passed the raw gatewayUrls.arweave value instead.

With getEnsAvatar({ name, assetGatewayUrls: { arweave: 'https://gw.example/' } }) and an https://arweave.net/<tx> avatar record (or NFT metadata image), the resolved URL was https://gw.example//<tx>. The same gateway resolves ar://<tx> to https://gw.example/<tx>. Gateways that treat //<tx> differently fail the isImageUri check, so the avatar does not resolve.

This uses the already-normalized arweaveGateway in that branch. Output for gateways without a trailing slash is unchanged.

  • Added a resolveAvatarUri test with a trailing-slash Arweave gateway. It fails without this change (https://example.com//rgW4…).
  • Added a patch changeset.

Checks run: pnpm test --run src/utils/ens/avatar/utils.test.ts -t "resolveAvatarUri|getGateway", pnpm check:types, Biome.

@vercel

vercel Bot commented Nov 19, 2026

Copy link
Copy Markdown

@mortezashojaei is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cc9d464

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

jxom commented Nov 19, 2026

Copy link
Copy Markdown
Member

Thanks @mortezashojaei, this was a correct fix! I folded the new test into the existing arweave replace default case and carried your commit over to #5601, which supersedes this PR.

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.

2 participants