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

Blackboard_six question import fails if the same image is used several times in the same question field

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.7, 2.3.4, 2.4.1
    • Fix Version/s: 2.3.5, 2.4.2, 2.5
    • Component/s: Questions
    • Labels:
      None
    • Testing Instructions:
      Hide

      Reproduce the bug in any MOODLE_23_STABLE MOODLE_24_STABLE, master moodle install where this fix is not applied, trying to import the file attached to this issue MDL-37934_testfile.zip using the Blackboard V6+ question import format should produce an error message similar to:
      Can not create file "5/user/draft/994659423///ppg_ppg0211132247_f1q1g1.jpg"
      Now trying to import the same file with the fix applied, one question should be imported without any error message displayed. The resulting question should have the same image once in the question text and twice in the same answer. The image is a small circle (degree sign).
      As the fix is very short and very simple I don't think additional tests are required.

      Show
      Reproduce the bug in any MOODLE_23_STABLE MOODLE_24_STABLE, master moodle install where this fix is not applied, trying to import the file attached to this issue MDL-37934 _testfile.zip using the Blackboard V6+ question import format should produce an error message similar to: Can not create file "5/user/draft/994659423///ppg_ ppg0211132247 _f1q1g1.jpg" Now trying to import the same file with the fix applied, one question should be imported without any error message displayed. The resulting question should have the same image once in the question text and twice in the same answer. The image is a small circle (degree sign). As the fix is very short and very simple I don't think additional tests are required.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull Master Branch:

      Description

      See https://moodle.org/mod/forum/discuss.php?d=191506&parent=964908
      the code is failing if the same image is used several times in the same field of the same question because in store_file_for_text_field function create_file_from_pathname is called several times with the exact same parameters.
      The solution is to check if file exists before trying to create it.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jmvedrine Jean-Michel Vedrine
              Reporter:
              jmvedrine Jean-Michel Vedrine
              Peer reviewer:
              Tim Hunt
              Integrator:
              Dan Poltawski
              Tester:
              Frédéric Massart
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Mar/13