Skip to content

Fix profile url backend & fix avatar upload using s3 - #27

Merged
boqiny merged 2 commits into
mainfrom
profile
Aug 25, 2025
Merged

Fix profile url backend & fix avatar upload using s3#27
boqiny merged 2 commits into
mainfrom
profile

Conversation

@boqiny

@boqiny boqiny commented Aug 25, 2025

Copy link
Copy Markdown
Collaborator

This pull request refactors profile update and avatar upload functionality to improve user experience and migrate avatar storage from local disk to Amazon S3. It introduces smarter normalization of social profile URLs, expands image format support, and enhances error handling and logging for avatar uploads and deletions.

Profile update improvements:

  • Added a normalize_url helper to intelligently convert user-entered social profile and website fields into proper URLs, accepting both usernames and full URLs for GitHub, Twitter, LinkedIn, and website fields.
  • Changed ProfileUpdateRequest schema fields for website, github, twitter, and linkedin from HttpUrl to str to allow flexible input formats, such as usernames or partial URLs.

Avatar upload and storage enhancements:

  • Migrated avatar uploads from local disk storage to Amazon S3, including new upload_avatar and delete_avatar methods in s3_service, and updated the avatar upload API to use these methods. This supports more image formats (webp added) and generates unique S3 URLs for avatars. [1] [2]
  • Added robust error handling and logging for avatar uploads and deletions, ensuring failures are logged and surfaced as HTTP errors when necessary. [1] [2]

S3 service improvements:

  • Expanded content type mapping in S3 service to support all major avatar image formats (jpg, jpeg, png, gif, webp).

@boqiny
boqiny merged commit 02914e6 into main Aug 25, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant