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

Flickr public fails when picture does not have a license

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.4, 2.3.1, 2.4
    • Fix Version/s: 2.2.5, 2.3.2
    • Component/s: Repositories
    • Labels:
    • Testing Instructions:
      Hide

      Test pre-requisites

      • Access to a Flickr Account
      • 1 image on Flickr which has no license (A)
      • 1 image on Flickr which has any license (B)
      • Enablie Flickr Public repository
      • Add an Flickr Public instance linked to the Flickr account
      • Debug to DEBUG_DEVELOPER

      Test steps

      1. Navigate to your private files and click 'Add'
      2. Browse the Flickr repository
      3. Select the file A and click 'Select file'
      4. Make sure the file is downloaded without errors/notices/warnings
      5. Select the file B and click 'Select file'
      6. Make sure the file is downloaded without errors/notices/warnings
      Show
      Test pre-requisites Access to a Flickr Account 1 image on Flickr which has no license (A) 1 image on Flickr which has any license (B) Enablie Flickr Public repository Add an Flickr Public instance linked to the Flickr account Debug to DEBUG_DEVELOPER Test steps Navigate to your private files and click 'Add' Browse the Flickr repository Select the file A and click 'Select file' Make sure the file is downloaded without errors/notices/warnings Select the file B and click 'Select file' Make sure the file is downloaded without errors/notices/warnings
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-35101-master

      Description

      When adding a picture from Flickr Public, a JSON error will break the process if the picture don't have a license. Well, it actually has a license of 0, which is the license 'All rights reserved' by default at Flickr. And in our table, the license 0 does not exist.

      More information about the possible licenses:
      http://www.flickr.com/services/api/flickr.photos.licenses.getInfo.html

      Replication steps

      1. Go to your Flickr account and add a file
      2. Set the debug level to DEBUG_DEVELOPER
      3. Enable the Flickr Public repository
      4. Add an instance using your email address linked with your Flickr account
      5. Go to your private files and click on 'Add'
      6. Navigate through the Flickr Public instance
      7. Select the newly uploaded picture and click 'Select file'

      Actual:

      • A wild JSON error appears

      Expected:

      • Everything is fine

      The JSON error:

      Invalid JSON string
       
      Notice: Undefined index: 0 in /home/fred/www/repositories/stable_master/moodle/repository/flickr_public/lib.php on line 225
       
      Call Stack:
          0.0006     837776   1. {main}() /home/fred/www/repositories/stable_master/moodle/repository/repository_ajax.php:0
          1.4430   35644696   2. repository_flickr_public->get_file() /home/fred/www/repositories/stable_master/moodle/repository/repository_ajax.php:290
          5.1195   35759024   3. repository_flickr_public->license4moodle() /home/fred/www/repositories/stable_master/moodle/repository/flickr_public/lib.php:477
       
      {"event":"fileexists","newfile":{"filepath":"\/","filename":"archive-48_2.jpg","url":"http:\/\/fred.moodle.local\/stable_master\/draftfile.php\/5\/user\/draft\/209152043\/archive-48_2.jpg"},"existingfile":{"filepath":"\/","filename":"archive-48.jpg","url":"http:\/\/fred.moodle.local\/stable_master\/draftfile.php\/5\/user\/draft\/209152043\/archive-48.jpg"}}

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    10/Sep/12