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: asset name parsing in static converter #501

Closed KristinAoki closed 3 months ago

KristinAoki commented 3 months ago

Description

This PR fixes images not loading in the visual text and problem editor. When assets were loaded with asset-v1:org+number+run+type@asset+block/image_name.png asset format, it would incorrectly parse to asset-v1:org+number+run+type@asset+block/asset-v1:org+number+run+type@asset+block@image_name.png. A similar issue was fixed in #497. The same src parser is now used for replaceStaticWithAsset as was added for setAssetToStaticUrl.

Testing

  1. Open an html block
  2. Add an image
  3. Click the "HTML" button in the toolbar
  4. Replace the second "@" with "/"
  5. Click "Save"
  6. Confirm that the image is still visible
codecov[bot] commented 3 months ago

Codecov Report

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

Project coverage is 88.92%. Comparing base (b68257e) to head (3e89706).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #501 +/- ## ======================================= Coverage 88.91% 88.92% ======================================= Files 248 248 Lines 4554 4558 +4 Branches 943 944 +1 ======================================= + Hits 4049 4053 +4 Misses 472 472 Partials 33 33 ```

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