Skip to content

Commit

Permalink
Fix missing user
Browse files Browse the repository at this point in the history
  • Loading branch information
manzt committed Oct 25, 2024
1 parent 38417a1 commit 8e1c5a8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/src/components/GitHubCard.astro
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export type Props = {
let { repo, description, stars } = Astro.props;
let url = Astro.props.url ?? `https://github.com/${repo}`;
let username = repo.split("/")[0];
// some may have deleted their account
let userExists = await fetch(`https://api.github.com/users/${username}`).then(
(res) => res.ok,
);
---

<div
Expand All @@ -33,7 +38,7 @@ let username = repo.split("/")[0];
<Image
class="h-6 w-6 rounded border"
inferSize
src={`https://www.github.com/${username}.png`}
src={userExists ? `https://www.github.com/${username}.png` : `https://github.com/identicons/manzt.png`}
alt={username}
/>
<div class="text-sm font-semibold">
Expand Down

0 comments on commit 8e1c5a8

Please sign in to comment.