Skip to content

Bugs with image URLs in Course Overview, including spurious "You've made some changes" #2668

@bradenmacdonald

Description

@bradenmacdonald
  1. 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:
Screen.Recording.2025-11-19.at.2.35.18.PM.mov
  1. It appears that we allow "Studio URLs" like /static/uploaded_image.png to 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.png which 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/foo even if it is actually served from a different URL during editing/preview.
  2. Because of replaceStaticWithAsset(), any course using either the default course overview template (1, above) or custom HTML with Studio URLs (2, above - /static/foo from "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.
      Image

Test / Reproduction Instructions.

  1. First, disable the replaceStaticWithAsset function so it just return false; immediately. This is just to allow you to make the changes in step 3 correctly.
  2. Next, upload an image called "example.jpg" to a course, using the "Files & Uploads" page.
  3. 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+24 parts 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@[email protected]" 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@[email protected]" align="left" alt="Image #4" style="max-width: 200px;" /></p>
</section>
  1. Restore the original replaceStaticWithAsset code.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions