# git: Use CDN endpoint for GitHub avatars to avoid rate limiting \(\#47894\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/36e35f7df194b55a8419893bac732098cf45a6a6)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 36e35f7df194b55a8419893bac732098cf45a6a6

Requested commit: 36e35f7df194b55a8419893bac732098cf45a6a6

Commit: 36e35f7df194b55a8419893bac732098cf45a6a6

Tree: a40fd29ce08d0236e9797b40a3f265ccbc390a5d

Author: Augustus Otu

Committer: GitHub

## Message

```
git: Use CDN endpoint for GitHub avatars to avoid rate limiting (#47894)

GitHub's commit API endpoint is rate limited to 60 requests/hour for
unauthenticated users. This causes avatar loading to fail after toggling
blame a few times.

This PR uses GitHub's CDN avatar endpoint
`https://avatars.githubusercontent.com/u/e?email={email}&s=128` instead,
which doesn't count against API rate limits. The author email is already
available from local git data (blame output), so
  no API calls are needed.

- When author email is available, constructs the CDN URL directly (zero
API calls)
  - Falls back to existing API-based behavior when email is unavailable
  - Adds unit tests for URL construction

  Closes #47590

  ## Test plan
  - [x] `./script/clippy` passes
- [x] `cargo test -p git_hosting_providers` passes (89 tests including 3
new ones i added)
- [ ] Manual test: Open a file, toggle git blame, verify avatars load
without hitting rate limits

  Release Notes:

- Fixed GitHub avatar rate limiting in git blame by using CDN endpoint
instead of API calls (#47590)
```

## Parents

- [8d18b7b927d13c9fa8bcb2f96d239674538d1464](https://git.cafe/gitcafe/zed/commit/8d18b7b927d13c9fa8bcb2f96d239674538d1464?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/36e35f7df194b55a8419893bac732098cf45a6a6?format=markdown)
