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

Large badge images stored but inaccessible

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.9.9, 3.0.6, 3.0.7, 3.1.2, 3.1.3, 3.2, 3.3.3, 3.4
    • Fix Version/s: 3.3.4, 3.4.1
    • Component/s: Badges
    • Labels:
    • Testing Instructions:
      Hide

      Set up

      1. Access as admin
      2. Create a site badge (it's not necessary to add any criteria)

       

      Testing instructions

      1. Enter to Overview page of the badge created during set-up
      2. Right click over the badge image to get the URL (for instance, in Chrome you can use "Copy image address"). The result must be something like "http://localhost/m/stable_xxxx/pluginfile.php/1/badges/badgeimage/20/f1?refresh=173"
      3. Open image addres in a new tab/window (as you prefer)
        • CHECK the image 100x100 is shown correctly
      4. Replace "f1?" in this image address to "f3?"
        • CHECK the image 512x512 is shown correctly

       

      Show
      Set up Access as admin Create a site badge (it's not necessary to add any criteria)   Testing instructions Enter to Overview page of the badge created during set-up Right click over the badge image to get the URL (for instance, in Chrome you can use "Copy image address"). The result must be something like "http://localhost/m/stable_xxxx/pluginfile.php/1/badges/badgeimage/20/f1?refresh=173" Open image addres in a new tab/window (as you prefer) CHECK the image 100x100 is shown correctly Replace "f1?" in this image address to "f3?" CHECK the image 512x512 is shown correctly  
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-57569-master

      Description

      When you create a badge and upload an image the image is processed and stored in three different sizes named f1, f2 and f3 for later use. However, the largest size, f3, is never accessible and if you ever try to get that version a file not found exception occurs.

      After much debugging I finally tracked it down to this code in filelib.php...

      if ($filearea === 'badgeimage') {
      if ($filename !== 'f1' && $filename !== 'f2')

      { send_file_not_found(); }

      Basically, only access to the small images are being processed here and anything else causes that file not found exception. Probably, someone forgot to add the f3 option in that line. Either the 'f3' option needs to be permitted here, or that entire if just needs to be removed.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  15/Jan/18