openedx / frontend-lib-content-components

[Moved to openedx/frontend-app-course-authoring] A library of high-level components for content handling (viewing, editing, etc. of HTML, video, problems, etc.), to be shared by multiple MFEs.
GNU Affero General Public License v3.0
11 stars 33 forks source link

fix: setAssetToStaticUrl regex matcher #497

Closed KristinAoki closed 3 months ago

KristinAoki commented 3 months ago

Description

This PR fixes the error of relative asset urls incorrectly rewriting the conversion to the static url. The regex matcher was catching all relative asset url formats:

This resulted in the first two version rewriting correctly as /static/image.jpeg and the third rewriting incorrectly as /static/assetblockimage.jpeg.

Testing

  1. Open a raw editor
  2. Add an image with a static link
  3. Save the block
  4. Using browser dev tools, copy the link for the image
  5. Reopen the block
  6. Confirm that the static is unaltered
  7. Paste the previously copied image
  8. Add images using the second and third bullet points' format from above
  9. Save the block
  10. Confirm that the newly added images are visible
  11. Reopen the block
  12. Confirm that all the links appear as static links and their names appear correctly
  13. Save block
  14. Confirm that all images are still visible

Repeat the steps in the text editor and advanced problem editor. Also, test opening and save existing content for regular problem editor.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.90%. Comparing base (3dfc579) to head (97e0de8).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #497 +/- ## ======================================= Coverage 88.90% 88.90% ======================================= Files 248 248 Lines 4552 4552 Branches 946 942 -4 ======================================= Hits 4047 4047 Misses 472 472 Partials 33 33 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.