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

Quiz duplication fails if questions have file links in their texts

XMLWordPrintable

      When you try to duplicate a quiz which has some questions with images or other files URLs like '<img src="http://moodle.devbox16.local/file.php/6/RspQ-2010%20Carbonyl%20Quiz%201/q6ethbr.gif" alt="Q6EthBr" align="bottom" border="0">' it will fail with  error_question_answers_missing_in_db

      It happens because backup_xml_transformer::process_filephp_links on backup and restore_structure_parser_processor::process_cdata on restore treat $@FILEPHP@$ differently.

      The first function replaces file path without a trailing slash, but the second function adds additional slash on restore.

      Because of that restore_qtype_match_plugin::process_match can't match questiontext as data coming from XML has an extra slash and it fails with 'error_qtype_match_subquestion_missing_in_db' exception. 

       

       Steps to replicate:

      1. Create a course.
      2. Restore attached quiz activity into it
      3. Try to duplicate an activity.
         

      As a side effect every time you backup and restore the activity again it adds more extra slashes to the file paths.

            dmitriim Dmitrii Metelkin
            dmitriim Dmitrii Metelkin
            Tim Hunt Tim Hunt
            Jun Pataleta Jun Pataleta
            Adrian Greeve Adrian Greeve
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

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