Repository navigation
fix: validate uploaded photo objects - #26
Merged
Merged
Conversation
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.
Summary
head_objectvalidation before confirming uploaded photos for user avatars, tutor profile photos, and tutor service photos.PHOTO_MAX_BYTES(8 MB), unavailable size/content type, and S3 content-type mismatches.ContentLength/ normalizedContentTypeinstead of client-provided size/type on confirm.E2E Trace
storage_key,content_type, andsize_byteswithout verifying that the object existed in S3 or matched metadata.MEDIA_READ_VIA_PROXY.Checks
uvx black app/services/media_uploads.py tests/tutor_profile_photos/test_create_photo.py && uvx isort app/services/media_uploads.py tests/tutor_profile_photos/test_create_photo.pypassed.DEBUG=true ENVIRONMENT=local DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/app_db uv run --group dev python -m compileall app testspassed.DEBUG=true ENVIRONMENT=local DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/app_db uv run --group dev pytest tests/tutor_profile_photos/test_create_photo.py tests/user_avatars/test_user_avatars.py tests/tutor_service_photos/test_tutor_service_photos.py; blocked at fixture setup because local Postgres onlocalhost:5432refused connections. Docker/Colima was also unavailable locally.Companion