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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 1.9.9
    • 2.0
    • Other
    • None
    • MOODLE_20_STABLE
    • MOODLE_19_STABLE

      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

            samhemelryk Sam Hemelryk
            samhemelryk Sam Hemelryk
            Nobody Nobody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.