Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-30208

HTML editor mangles background URL filenames

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.1.2
    • Fix Version/s: None
    • Component/s: HTML Editor (TinyMCE)
    • Labels:
    • Affected Branches:
      MOODLE_21_STABLE

      Description

      When a URL is specified as a CSS background in a style attribute, relative URLs are always converted to absolute URLs. However, after that first conversion, the function also mangles URL paths that contain an underscore followed by a number. E.g.

      <p style="background: url('http://example.org/dir_2/filename_2.jpg');">hello</p>

      Is converted to:

      <p style="background: url('http://example.org/dir;/filename;.jpg');">hello</p>

      The conversion that happens is predictable:

      _0 => &quot;
      _1 => \'
      _2 => ;
      _3 => :
      _4 => ;
      _5 => :
      _6 => _
      _7 => undefined
      _8 => undefined
      _9 => undefined

      Replication steps:

      1. Enter this using the raw HTML editor:

        <p style="background: url('http://example.org/dir_2/filename_2.jpg');">hello</p>

      2. Then close and re-open the raw HTML editor, and you'll see:

        <p style="background: url('http://example.org/dir;/filename;.jpg');">hello</p>

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: