fix: recurse through pasted block data to replace static paths - #36723
Conversation
|
Thanks for the pull request, @pomegranited! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
e.g when the block is a drag-and-drop block, the data is a complex dict with nested data that may also contain static file URLs.
30e709d to
8efa5a5
Compare
rpenido
left a comment
There was a problem hiding this comment.
LGTM 👍
Thank you for your work, @pomegranited!
Beautiful solution!
- I tested this using the instructions from the PR
- I read through the code
- I checked for accessibility issues
- Includes documentation
|
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
|
2U Release Notice: This PR has been deployed to the edX production environment. |
…dx#36723) Fixes an error that is triggered when trying to copy/pasting Drag-and-drop block into Courses. When a block is pasted into a Course or Library, we perform a search/replace on block's data to replace any old static URLs with their new path. Ordinary blocks like HTML and Video have a simple string of data where static URLs may live, but DnDv2 blocks have a dict of data which can contain other dicts and lists of strings that need to be modified. Other XBlocks may have similarly complex structures, and so this fix will resolve them as well. This fixes the issue by recursing into the data structure to locate all the strings where replacements may need to be made. This fix helps Course Authors use content staging in their Courses. (cherry picked from commit 21399b4)
… (#36773) Fixes an error that is triggered when trying to copy/pasting Drag-and-drop block into Courses. When a block is pasted into a Course or Library, we perform a search/replace on block's data to replace any old static URLs with their new path. Ordinary blocks like HTML and Video have a simple string of data where static URLs may live, but DnDv2 blocks have a dict of data which can contain other dicts and lists of strings that need to be modified. Other XBlocks may have similarly complex structures, and so this fix will resolve them as well. This fixes the issue by recursing into the data structure to locate all the strings where replacements may need to be made. This fix helps Course Authors use content staging in their Courses. (cherry picked from commit 21399b4)
Fixes an error that is triggered when trying to copy/pasting Drag-and-drop block into Courses. When a block is pasted into a Course or Library, we perform a search/replace on block's data to replace any old static URLs with their new path. Ordinary blocks like HTML and Video have a simple string of data where static URLs may live, but DnDv2 blocks have a dict of data which can contain other dicts and lists of strings that need to be modified. Other XBlocks may have similarly complex structures, and so this fix will resolve them as well. This fixes the issue by recursing into the data structure to locate all the strings where replacements may need to be made. This fix helps Course Authors use content staging in their Courses.
…dx#36723) (openedx#36773) Fixes an error that is triggered when trying to copy/pasting Drag-and-drop block into Courses. When a block is pasted into a Course or Library, we perform a search/replace on block's data to replace any old static URLs with their new path. Ordinary blocks like HTML and Video have a simple string of data where static URLs may live, but DnDv2 blocks have a dict of data which can contain other dicts and lists of strings that need to be modified. Other XBlocks may have similarly complex structures, and so this fix will resolve them as well. This fixes the issue by recursing into the data structure to locate all the strings where replacements may need to be made. This fix helps Course Authors use content staging in their Courses. (cherry picked from commit 21399b4) (cherry picked from commit 8bcdfbf)
…dx#36723) (openedx#36773) Fixes an error that is triggered when trying to copy/pasting Drag-and-drop block into Courses. When a block is pasted into a Course or Library, we perform a search/replace on block's data to replace any old static URLs with their new path. Ordinary blocks like HTML and Video have a simple string of data where static URLs may live, but DnDv2 blocks have a dict of data which can contain other dicts and lists of strings that need to be modified. Other XBlocks may have similarly complex structures, and so this fix will resolve them as well. This fixes the issue by recursing into the data structure to locate all the strings where replacements may need to be made. This fix helps Course Authors use content staging in their Courses. (cherry picked from commit 21399b4)
Description
This PR fixes an error that is triggered when trying to copy/pasting Drag-and-drop block into Courses.
When a block is pasted into a Course or Library, we perform a search/replace on block's
datato replace any old static URLs with their new path. Ordinary blocks like HTML and Video have a simple string ofdatawhere static URLs may live, but DnDv2 blocks have a dict ofdatawhich can contain other dicts and lists of strings that need to be modified. Other XBlocks may have similarly complex structures, and so this fix will resolve them as well.This fixes the issue by recursing into the
datastructure to locate all the strings where replacements may need to be made.This fix helps Course Authors use content staging in their Courses.
Supporting information
No github issue -- discovered this bug while doing something else.
Private-ref: FAL-4080
Testing instructions
Ensure that the pasted Drag and Drop block shows all its images correctly, and that these images were all copied into the new course.
Deadline
ASAP -- will need to backport to Teak.