Skip to content

enhancement: Sanitize developer usernames by stripping leading '@' and GitHub URLs #254

Open

Description

@O2sa

When users paste or type usernames with a leading @ (e.g. @torvalds) or paste a full GitHub profile URL (e.g. https://github.com/octocat), the application passes the raw string to GitHub GraphQL. The GraphQL API returns a 404 / User Not Found error.

Motivation

Users frequently copy developer handles with @ or paste profile URLs directly from their browser address bar. Automatically sanitizing inputs prevents unnecessary API errors and simplifies user flow.

Tasks

  • Create a helper cleanGitHubUsername(input: string): string in src/utils/github.ts (or src/utils/string.ts).
  • Handle leading @ removal (e.g., @shadcn -> shadcn).
  • Extract username from GitHub URLs (e.g., https://github.com/shadcn/ -> shadcn).
  • Trim whitespace and trailing slashes.
  • Use cleanGitHubUsername in CompareForm inputs, src/app/api/compare/route.ts, and src/app/api/user/[username]/route.ts.
  • Add unit tests covering various input formats.

Files to Check

  • src/utils/github.ts
  • src/features/comparison/components/compare-form.tsx
  • src/app/api/compare/route.ts
  • src/app/api/user/[username]/route.ts

Tip

🚀 Want to contribute?
Comment assign me to be automatically assigned to this issue via our GitHub Actions bot. Happy coding! ✨

Activity

  1. abhinavrastogi2627 commented on Oct 20, 2026

    @abhinavrastogi2627
    Contributor

    assign me

  2. github-actions commented on Oct 20, 2026

    @github-actions

    🎉 Issue assigned to @abhinavrastogi2627! Happy coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions