Moodle
  1. Moodle
  2. MDL-32430

Invalid URLs in the calendar event's quiz description

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.1.6, 2.2.3
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      39294

      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.

        Activity

        Hide
        Tim Hunt added a comment -

        Thanks for spotting this David. I wonder why this was missed when it was done for all the other modules?

        Show
        Tim Hunt added a comment - Thanks for spotting this David. I wonder why this was missed when it was done for all the other modules?
        Hide
        Tim Hunt added a comment -

        TO INTEGRATORS: please integrate the clean-up in MDL-32788 first in master.

        Show
        Tim Hunt added a comment - TO INTEGRATORS: please integrate the clean-up in MDL-32788 first in master.
        Hide
        Dan Poltawski added a comment -

        Integrated, thanks!

        Show
        Dan Poltawski added a comment - Integrated, thanks!
        Hide
        Rossiani Wijaya added a comment -

        This is working fine.

        Test passed.

        Show
        Rossiani Wijaya added a comment - This is working fine. Test passed.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        This is now part of Moodle and a few millions people around the globe will be using it soon. Isn't that awesome?

        Many, many thanks and don't forget http://youtu.be/4N7dPaP5Z8U

        Closing, ciao

        Show
        Eloy Lafuente (stronk7) added a comment - This is now part of Moodle and a few millions people around the globe will be using it soon. Isn't that awesome? Many, many thanks and don't forget http://youtu.be/4N7dPaP5Z8U Closing, ciao

          People

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

            Dates

            • Created:
              Updated:
              Resolved: