Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.

fix(avatar): serve avatars via API proxy (uploaded images now display)#89

Merged
Enes1998 merged 1 commit into
mainfrom
fix/avatar-display
Jun 7, 2026
Merged

fix(avatar): serve avatars via API proxy (uploaded images now display)#89
Enes1998 merged 1 commit into
mainfrom
fix/avatar-display

Conversation

@Enes1998

@Enes1998 Enes1998 commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Bug: after uploading a profile picture (freelancer + enterprise), it never shows — not on the edit page nor the top-right circle.

Root cause (verified): UploadAvatarCommandHandler stored the raw S3 object key (avatars/<id>/file.png) in user.AvatarUrl, and MinIO is internal-only (minio:9000, no public ingress; mentor cluster allows no extra subdomain). So neither the key nor an internal presigned URL is reachable from a browser → <img> 404s.

Fix: serve avatars through the API (the api host is already public):

  • Anonymous GET /api/v1/profile/avatar?key=… streams the object from MinIO.
  • Upload stores the absolute proxy URL → every render site (cards, top-right menu, match cards) works with no per-site changes.
  • StorageOptions.PublicBaseUrl (prod https://api.project-01.gjirafa.dev, dev :8081).
  • Profile cards update authStore on upload → top-right avatar refreshes live.

Note: the one pre-existing avatar (stored as a raw key) stays broken until re-uploaded.

Verified: dotnet build ✓, unit tests 22/22 ✓, tsc ✓, next lint 0 ✓.

UploadAvatarCommandHandler stored the raw S3 object key in user.AvatarUrl, and MinIO
is internal-only (no public ingress, no extra subdomain allowed) — so neither the key
nor an internal presigned URL is browser-reachable. Result: avatars never rendered.

- Add an anonymous GET /api/v1/profile/avatar?key=... endpoint that streams the object
  from MinIO through the API (the api host is public).
- IFileStorageService: GetObjectAsync (buffered) + GetPublicUrl(key); StorageOptions
  gains PublicBaseUrl (values.yaml=https://api.project-01.gjirafa.dev, dev=:8081).
- Upload now stores the absolute proxy URL, so every render site works unchanged.
- Profile cards update authStore on upload so the top-right avatar refreshes live.

Note: pre-existing avatars stored as raw keys stay broken until re-uploaded.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Enes1998 Enes1998 merged commit 9b0f0cd into main Jun 7, 2026
6 checks passed
@Enes1998 Enes1998 deleted the fix/avatar-display branch June 13, 2026 16:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant