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

mediaplugin filters capture way too much

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 1.9.5
    • Filters
    • None
    • MOODLE_19_STABLE
    • Easy

      While taking a look to MDL-19231 I've detected that ALL the regexp used to detect videos/audios.... whatever, are in the form:

      $search = '/<a.?href="([^<])youtube.com\/watch?v=([^"])"[^>]>(.*?)<\/a>/is';

      And that .*, no matter of the ? (greedy) after it... seems to be capturing way too much. So any text containing any <a> tag, followed by one URL being processed by the mediaplugin filter.... is really borked (unless I'm forgetting something).

      In the filter_mediaplugin_enable_youtube customization, I've replaced it to:

      $search = '/<a[^>]?href="([^<])youtube.com\/watch?v=([^"])"[^>]>(.*?)<\/a>/is';

      And now it seems to work ok. Perhaps the same change:

      .* ==> [^>]* should be applied to all regexp in that filter. It's really strange nobody has claimed that before (sure I'm missing something).

      For your consideration, ciao

            skodak Petr Skoda
            stronk7 Eloy Lafuente (stronk7)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            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.