Fix #2887: Sponsor logo collides with section header text#2930
Fix #2887: Sponsor logo collides with section header text#2930iampujan wants to merge 3 commits intopython:mainfrom
Conversation
- Replaced 0fr with 1fr in the CSS Grid template for the sponsor listings to prevent overflow on wrapping. - Removed hardcoded 'grid-template-rows' logic that caused implicit rows to overlap. - Handled missing image logo metadata by resolving 'ValueError' in the 'ideal_size' sponsor templatetag.
There was a problem hiding this comment.
Pull request overview
This pull request fixes issue #2887 where sponsor logos were colliding with section header text on the sponsors page. The fix addresses two related problems: incorrect CSS grid properties causing layout overflow, and a server error from missing image handling.
Changes:
- Fixed CSS grid layout by replacing invalid
0frvalues with1frand removing the hardcoded single row constraint to allow proper wrapping - Added
ValueErrorexception handling in theideal_sizetemplate filter to handle corrupted or invalid image files - Added bottom margin spacing between sponsor sections
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/sponsors/templates/sponsors/partials/sponsors-list.html | Updated CSS grid properties from 0fr to 1fr, removed single-row constraint, and added section spacing to fix logo overflow issue |
| apps/sponsors/templatetags/sponsors.py | Added ValueError to exception handling in ideal_size filter to prevent 500 errors from invalid image files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try: | ||
| w, h = image.width, image.height | ||
| except FileNotFoundError: | ||
| except (FileNotFoundError, ValueError): |
There was a problem hiding this comment.
The ideal_size filter now catches ValueError in addition to FileNotFoundError, but there's no test coverage for this filter. Consider adding tests to verify the error handling behavior, especially for cases where the image file is missing or has invalid dimensions that could raise ValueError.
Covers FileNotFoundError and ValueError exception handling for missing image files.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes #2887. Replaces invalid 0fr column grid properties with 1fr, and removes hardcoded 1 row rule to correctly let sponsor items naturally wrap to multiple rows without overflowing into the next section. Also fixes a 500 error triggered by missing image file paths in the 'ideal_size' filter.