feat(account): Add direct profile picture upload and removal via FastAPI endpoints - #13290
Open
RsbhThakur wants to merge 1 commit into
Open
Conversation
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #13263
feat: Add direct profile picture upload and removal via FastAPI endpoints
Technical
FastAPI Avatar Endpoints (
openlibrary/fastapi/account.py):POST /account/avatarendpoint with Pillow image validation, EXIF metadata stripping, RGB normalization, and max 500x500 JPEG re-encoding.ia.get_item().upload) withqueue_derive=Truesignal for automatic thumbnail derivative processing.DELETE /account/avatarendpoint to remove custom profile picture timestamp and reset avatar URL.avatar_updatedtimestamp and invalidatesuser-avatar-{username}Memcached key.Reverse Proxy Stream Fix (
openlibrary/plugins/openlibrary/deprecated_handler.py):v.file.read()to preventUnicodeDecodeErrorwhen proxying multipart form data from legacyweb.pytoFastAPI.UI Enhancements (
openlibrary/templates/type/user/edit.html):srcto route via$(page.key)/avatarwith circular container overflow andonerrorfallback safety.URL.createObjectURL) on file selection.Model Formatting (
openlibrary/core/models.py):itemnameformatting with@prefix inUser.get_avatar_url()and appended?v={avatar_updated}query parameter for CDN/browser cache invalidation.Testing
Automated Unit Tests:
(19/19 pytest unit tests passing in 1.04s)
Pre-commit Quality Hooks:
(All linter, formatter, walrus, and i18n hooks passed cleanly)
Manual Verification:
http://localhost:8080/people/<username>?m=edit.Screenshot
Stakeholders