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

Invalid URLs in the calendar event's quiz description

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.2
    • 2.1.6, 2.2.3
    • Quiz
    • MOODLE_22_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • Hide

      1. Create a quiz with an image in the introduction test, and with a close date.

      2. Look at the event in the course calendar. Make sure the image has a proper pluginfile.php URL.

      Show
      1. Create a quiz with an image in the introduction test, and with a close date. 2. Look at the event in the course calendar. Make sure the image has a proper pluginfile.php URL.

    Description

      The current code for updating quiz calendar events uses something like

      $event->description = $quiz->intro;

      where $quiz is the raw object used by quiz_add_instance() etc. The course/mod.php processes the intro field automatically - but only after this calendar event handling code. So if there are images embedded into the quiz description, the event is created/updated with invalid URLs like

      <img src="http://moodle/draftfile.php?file=/user/draft/188339625/image.png" />

      which is tricky to spot as it actually displays the image to the user who created/updated the quiz for the limited period of the draft file area lifetime.

      The docs page http://docs.moodle.org/dev/Calendar_API suggests using format_module_intro() to convert draftfile URLs into correct ones, and all modules I checked use this approach. After fixing the quiz_update_events(), an upgrade step might be needed to go through all quiz instances and reformat the description field of their events.

      Attachments

        Activity

          People

            timhunt Tim Hunt
            mudrd8mz David Mudrák (@mudrd8mz)
            Dan Poltawski Dan Poltawski
            Rossiani Wijaya Rossiani Wijaya
            Tim Hunt, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              14/May/12