Skip to content

Conversation

@murray3k
Copy link
Contributor

This affected all Choosers inside a ListBlock , when only one of them is translated and the other kept unchanged.
I added a simple empty check to handle_list_block so that self.handle_block is not called when there are no block_segments , which was causing the IndexError later. This fixes #855.

Added two Tests. One with images in a list where only one is changed and another one for a list with PageChooserBlocks. Might be redundant, but I wanted to test that this issue is with all choosers and not just the PageChooserBlock where we encountered it.

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.18%. Comparing base (0800647) to head (619a676).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #856      +/-   ##
==========================================
+ Coverage   93.13%   93.18%   +0.04%     
==========================================
  Files          47       47              
  Lines        4241     4242       +1     
  Branches      550      551       +1     
==========================================
+ Hits         3950     3953       +3     
+ Misses        174      173       -1     
+ Partials      117      116       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@zerolab zerolab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one. Thank you @murray3k

@zerolab zerolab merged commit 345786a into wagtail:main May 6, 2025
12 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.

ListBlock with PageChooserBlock can cause IndexError with mixed translations

3 participants