fix: Popup window name can contain more than one "__"#1575
Conversation
There was a problem hiding this comment.
Sorry @fsbraun, your pull request is larger than the review limit of 150000 diff characters
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1575 +/- ##
=======================================
Coverage 76.98% 76.98%
=======================================
Files 78 78
Lines 3671 3671
Branches 498 498
=======================================
Hits 2826 2826
Misses 675 675
Partials 170 170 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@sourcery-ai Ignore the bundle files for reviewing |
|
Understood, I’ll ignore the bundle files when considering this PR and focus the review on the functional and source changes only. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the windowname_to_id function that parses popup window names. The function previously assumed window names contained only one set of double underscores (__), which could break with newer Django versions or complex naming patterns. The fix changes from using split('__')[0] to using lastIndexOf('__') with substring() to extract everything before the last occurrence of __.
Changes:
- Updated
windowname_to_idfunction to uselastIndexOf("__")instead ofsplit("__")[0] - The bundled JavaScript file reflects this same change
Reviewed changes
Copilot reviewed 1 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| filer/static/filer/js/addons/popup_handling.js | Core fix: changed window name parsing to find the last __ occurrence |
| filer/static/filer/js/dist/admin-file-widget.bundle.js | Bundled version containing the same fix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
The silent assumption that the popup window name only contains one set of dunder symbols (
__) is broken, potentially by newer Django versions.Now, only the last
__is cut from the pupup window name to find the widget it belongs to.Related resources
Checklist
masterSlack to find a “pr review buddy” who is going to review my pull request.