Skip to content

[FEATURE] enhancement: Return a placeholder image for invalid usernames #65

@aliviahossain

Description

@aliviahossain

Problem / Motivation

If you request an avatar for a GitHub username that doesn't exist (e.g., /a-truly-non-existent-user-12345), the API currently returns a generic 404 Not Found error. This can result in a broken image icon on websites using the API. A better user experience would be to return a default or "user not found" placeholder image.

Proposed Solution

Modify the main request handler in main.ts. When the call to getAvatarUrl() fails or returns a "not found" status, instead of setting ctx.response.status = 404, the API should:
Have a default placeholder image (e.g., a simple question mark or GitHub's Octocat logo) stored in the frames/ directory, named something like not-found.png.
Serve this placeholder image as the response, just like it serves the generated avatars. This provides a graceful fallback and avoids broken images.

PLEASE ASSIGN ME THIS ISSUE UNDER THE GSSOC' 25 LABEL. THANK YOU.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions