Problem / Opportunity
- Problem: Currently, Open Library users cannot upload or change their profile picture (avatar) directly on the platform. The avatar URL is generated via
https://archive.org/services/img/{itemname} (where itemname is the user's Internet Archive item ID, typically @username). To update their profile picture, users have to leave Open Library, navigate to Archive.org, log in there, locate their account item page, and upload their image there.
- Justify: This multi-step, multi-site journey is extremely counter-intuitive. Users expect to edit all their profile details in one place. As a direct result, Lisa and the helpdesk support team receive a steady, high volume of support inquiries from users asking how to update their profile picture or reporting it as broken/missing.
- Success Criteria: Users should be able to upload, update, and delete their profile picture directly from the edit profile page on Open Library. The new profile picture should show up immediately across the site (without waiting for the 24-hour cache expiry).
Proposal
- Add an image file input (with format/size validation) to the profile edit form.
- Create a FastAPI endpoint (e.g.
POST /account/avatar) to receive the uploaded image.
- Use the logged-in patron's decrypted
s3_keys (via get_s3_keys(account)) to upload the image directly to their Internet Archive account item (typically @username) using the internetarchive Python SDK or S3 API.
- Invalidate the
User.get_avatar_url cache upon a successful upload so the change is immediately visible.
Breakdown
Implementation Details (for maintainers)
Related files
Refer to this map of common Endpoints:
Requirements Checklist
Stakeholders
- @seabelis (Community Manager & Support Lead) - Primary contact for user feedback and support coordination.
- Backend Leads / Security team - To review S3 upload policies, rate limits, and allowed image formats.
Instructions for Contributors
Problem / Opportunity
https://archive.org/services/img/{itemname}(whereitemnameis the user's Internet Archive item ID, typically@username). To update their profile picture, users have to leave Open Library, navigate to Archive.org, log in there, locate their account item page, and upload their image there.Proposal
POST /account/avatar) to receive the uploaded image.s3_keys(viaget_s3_keys(account)) to upload the image directly to their Internet Archive account item (typically@username) using theinternetarchivePython SDK or S3 API.User.get_avatar_urlcache upon a successful upload so the change is immediately visible.Breakdown
Implementation Details (for maintainers)
Related files
Refer to this map of common Endpoints:
openlibrary/core/models.py- Containsget_avatar_urlwhich generates the avatar link from the Archive.org item.openlibrary/plugins/upstream/mybooks.py- Defines the/people/{username}/avatarendpoint which performs a redirect.openlibrary/templates/type/user/edit.html- The template for the edit profile form.openlibrary/templates/account.html- Links to/people/{username}?m=edit.openlibrary/fastapi/account.py- Place for new FastAPI endpoints for handling account modifications.Requirements Checklist
POST /account/avatar) to receive the uploaded image.get_s3_keysto authenticate and upload the photo to the user's Internet Archive item (@username) using theinternetarchivePython SDK or S3 API.User.get_avatar_urlcache upon a successful upload.Stakeholders
Instructions for Contributors