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

Flickr public fails when picture does not have a license

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.2.5, 2.3.2
    • 2.2.4, 2.3.1, 2.4
    • Repositories
    • MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • MOODLE_22_STABLE, MOODLE_23_STABLE
    • MDL-35101-master
    • 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

      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"}}

            fred Frédéric Massart
            fred Frédéric Massart
            Marina Glancy Marina Glancy
            Aparup Banerjee Aparup Banerjee
            Aparup Banerjee Aparup Banerjee
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

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