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

HTMLPurify is replacing line breaks with \n causing comparisons after cleaning to always fail

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 1.9.9
    • Component/s: Other
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      Hi Petr,

      We've managed to find a bug ~ set back with the HTML purify library. It would appear currently there are alot of checks that are broken after cleaning has occurred (PARAM_TEXT or PARAM_CLEAN).
      The problem appears to be that HTMLPurify is normalising line breaks in text to \n causing the comparisons to break as many clients send \r\n.

      I've been talking to Martin and Jerome about it and the general feeling seems to be that it would wonderful to normalise all text in Moodle but the task would be too huge to be worth tackling.
      We've had a quick look at the HTMLPurify library and come up with a small hack that resolves the problem by sorting it so that HTMLPurify doesn't normalise the text or replace line breaks with the system preferred after cleaning.
      I've attached a patch to illustrate what we found to work.

      Keen to see what you think on this one!

      Cheers
      Sam

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  8/Jun/10