Skip to content

fix: use normalized, URL-encoded ENS name for avatar proxy URL#680

Merged
rickstaa merged 1 commit into
mainfrom
fix/ens-avatar-url-encoding
May 25, 2026
Merged

fix: use normalized, URL-encoded ENS name for avatar proxy URL#680
rickstaa merged 1 commit into
mainfrom
fix/ens-avatar-url-encoding

Conversation

@rickstaa
Copy link
Copy Markdown
Member

@rickstaa rickstaa commented May 25, 2026

Follow-up to #679.

Change

Build the avatar proxy URL from the normalized name and encodeURIComponent the path segment:

avatar: avatar
  ? `/api/ens-data/image/${encodeURIComponent(normalizedName)}`
  : null,

Why

  • Encoding: a normalized ENS name can still contain Unicode (emoji domains); raw Unicode in a URL path segment is invalid. ASCII names like transcode.eth are unaffected (no-op).
  • Normalized name: the image route (pages/api/ens-data/image/[name].tsx) checks its blacklist on the raw param before normalizing, so feeding it the canonical form keeps that filter consistent. The route re-normalizes, so this is idempotent.

Addresses a Copilot review comment on #679.

Build the avatar proxy URL from the normalized name and URL-encode the
segment, so Unicode/emoji names are valid in the path and the image
route's name-based blacklist operates on the canonical form.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Copilot <copilot@github.com>
@rickstaa rickstaa requested a review from ECWireless as a code owner May 25, 2026 15:16
Copilot AI review requested due to automatic review settings May 25, 2026 15:16
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
explorer-arbitrum-one Ready Ready Preview, Comment May 25, 2026 3:19pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Warning

Review limit reached

@rickstaa, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 1 review of capacity. Refill in 31 minutes and 41 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: c209c4f7-c74b-4fed-af0a-0aa735bd9b0f

📥 Commits

Reviewing files that changed from the base of the PR and between 4f63efa and 4d4cd18.

📒 Files selected for processing (1)
  • lib/api/ens.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ens-avatar-url-encoding

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates ENS avatar proxy URL construction to use the ENS normalized name and to URL-encode it when embedding it in the /api/ens-data/image/[name] path segment, preventing invalid raw-Unicode paths for emoji/Unicode ENS names and aligning with the API route’s pre-normalization blacklist check behavior.

Changes:

  • Build the avatar proxy URL from normalizedName instead of name.
  • Apply encodeURIComponent to the ENS name used in the avatar proxy URL path segment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rickstaa rickstaa merged commit 9959381 into main May 25, 2026
13 checks passed
@rickstaa rickstaa deleted the fix/ens-avatar-url-encoding branch May 25, 2026 15:20
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