openedx / openedx/frontend-app-authoring
Bugs with image URLs in Course Overview, including spurious "You've made some changes"
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17
- Forks
- 218
- Avg merge
- 9d 20h
- Merged PRs (30d)
- 20
Description
- The default "Course Overview" template (in
overview.yaml) includes an image with the URL/static/images/placeholder-faculty.png(which gets served from the LMS (?) -http://local.openedx.io:8000/static/images/placeholder-faculty.png).- Bug: clicking on the editor or making any changes will trigger
replaceStaticWithAsset()and change this URL to a course-specific URL that doesn't actually exist, making the image broken:
- Bug: clicking on the editor or making any changes will trigger
https://github.com/user-attachments/assets/72699c2b-2f54-4dc4-81f2-93b966b977e3
- It appears that we allow "Studio URLs" like
/static/uploaded_image.pngto be in the Course Overview field, but as soon as you make any edits to the HTML, they will be rewritten to/asset-v1:Org+Course+Run+type@asset+block@uploaded_image.pngwhich will work only as long as the course ID is not changed. * Bug: If the course is imported onto a different instance with a different course ID, this URL will no longer work. The HTML editor should not actually change the URL in the HTML, and keep it as/static/fooeven if it is actually served from a different URL during editing/preview. - Because of
replaceStaticWithAsset(), any course using either the default course overview template (1, above) or custom HTML with Studio URLs (2, above -/static/foofrom "Files & Uploads") will have a bug.- Bug: "You've made some changes" will appear on such courses on the "Schedule & Details" page even if no changes have yet been made, because the URL rewriting has changed the HTML.
- Bug: "You've made some changes" will appear on such courses on the "Schedule & Details" page even if no changes have yet been made, because the URL rewriting has changed the HTML.
Test / Reproduction Instructions.
- First, disable the
replaceStaticWithAssetfunction so it justreturn false;immediately. This is just to allow you to make the changes in step 3 correctly. - Next, upload an image called "example.jpg" to a course, using the "Files & Uploads" page.
- Finally, from the "Schedule & Details" page, use the "HTML" toolbar button to set the course's "Course Overview" HTML to the following (change the two
BradenX+XBT+24parts to the correct course ID!):
<section class="about">
<p>Here is an image from <code>overview.yaml</code>:</p>
<p><img src="/static/images/placeholder-faculty.png" align="left" alt="Image #1" style="max-width: 200px;" /></p>
<p>Here is an image from the course, using Studio URL:</p>
<p><img src="/static/example.jpg" align="left" alt="Image #2" style="max-width: 200px;" /></p>
<p>Here is an image from the course, using full web URL:</p>
<p><img src="http://local.openedx.io:8000/asset-v1:BradenX+XBT+24+type@asset+block@example.jpg" align="left" alt="Image #3" style="max-width: 200px;" /></p>
<p>Here is an image from the course, using partial web URL:</p>
<p><img src="/asset-v1:BradenX+XBT+24+type@asset+block@example.jpg" align="left" alt="Image #4" style="max-width: 200px;" /></p>
</section>
- Restore the original
replaceStaticWithAssetcode. - Refresh the "Schedule & Details" page. Note that some images will be broken. To fix the bug, no images should be broken, and no "You've made some changes" should appear.
Notes
Make sure that any fixes here don't introduce regressions into the WYSIWYG editor / URL features used for problems and text components, in both courses and libraries.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with replaceStaticWithAsset in src/editors/sharedComponents/TinyMceWidget/hooks.ts and reproduce the Course Overview cases using the issue's HTML and image-upload steps. Check overview.yaml and the Schedule & Details editor behavior. Done means images remain usable, no spurious "You've made some changes" appears, and WYSIWYG URL behavior for problems and text components is not regressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100