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

Repositories with specific supported filetypes do not display in filepicker

    Details

    • Testing Instructions:
      Hide

      Test pre-requisites

      • Enable Google Docs repository
      • Enable Picasa repository
      • Enable Dropbox repository

      Test steps

      1. Create a database resource with a picture field, and add an entry
      2. Make sure Google Docs does not appear in Filepicker
      3. Make sure Dropbox and Picasa appear in Filepicker
      4. Go to your privates files
      5. Hack the code of users/filesedit.php (users/files.php on 2.3 and master) and change accepted_types to

      • '.jpg'
      • array('.jpg')
      • array('image')

      6. Make sure Google Docs does not appear in Filepicker for each parameter
      7. Make sure Dropbox and Picasa appear in Filepicker for each parameter
      8. Now set accepted_types to:

      • '*'
      • array('*')

      9. For both parameters, make sure Dropbox, Picasa and Google Docs appear in Filepicker

      Show
      Test pre-requisites Enable Google Docs repository Enable Picasa repository Enable Dropbox repository Test steps 1. Create a database resource with a picture field, and add an entry 2. Make sure Google Docs does not appear in Filepicker 3. Make sure Dropbox and Picasa appear in Filepicker 4. Go to your privates files 5. Hack the code of users/filesedit.php (users/files.php on 2.3 and master) and change accepted_types to '.jpg' array('.jpg') array('image') 6. Make sure Google Docs does not appear in Filepicker for each parameter 7. Make sure Dropbox and Picasa appear in Filepicker for each parameter 8. Now set accepted_types to: '*' array('*') 9. For both parameters, make sure Dropbox, Picasa and Google Docs appear in Filepicker
    • Workaround:
      Hide

      lib/form/filemanager.php:127
      - $accepted_types = (array) $this->_options['accepted_types'];
      + $accepted_types = $this->_options['accepted_types'];

      Show
      lib/form/filemanager.php:127 - $accepted_types = (array) $this->_options ['accepted_types'] ; + $accepted_types = $this->_options ['accepted_types'] ;
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-34507-master

      Description

      This appears to be caused by the changes made in MDL-30008.

      Any repository which has supported_filetypes other than '*' will not be available in the upload filepicker.

      Steps to replicate:

      1. Add more repositories to your site, eg. googledocs, youtube

      2. Attempt to upload a file.

      Expected: Option to use these repositories for file uploads.

      Result: These repositories will be missing

      3. In lib/form/filemanager.php:127
      - $accepted_types = (array) $this->_options['accepted_types'];
      + $accepted_types = $this->_options['accepted_types'];

      4. Attempt to upload a file again. The missing repositories will be available. But the supported_filetypes filter will not be used.

      I think that the code in repository/lib.php:845 need to be changed to fix this.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  6 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

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