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
    • Rank:
      42928

      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.

        Issue Links

          Activity

          Hide
          Chris Wharton added a comment -
          Show
          Chris Wharton added a comment - Discussion here: http://moodle.org/mod/forum/discuss.php?d=207664
          Hide
          Frédéric Massart added a comment -

          Here is a patch that will fix not only the regression but possible issues in 2.3 and master.

          Integrators, I think we should backport this to 2.1 as this regression has been integrated into the latest 2.1.

          Show
          Frédéric Massart added a comment - Here is a patch that will fix not only the regression but possible issues in 2.3 and master. Integrators, I think we should backport this to 2.1 as this regression has been integrated into the latest 2.1.
          Hide
          Marina Glancy added a comment -

          Looks fine for me

          Show
          Marina Glancy added a comment - Looks fine for me
          Hide
          Aparup Banerjee added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Aparup Banerjee added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Chris Wharton added a comment -

          This patch doesn't appear to work for the Youtube repository, as shown in attached screenshot

          Show
          Chris Wharton added a comment - This patch doesn't appear to work for the Youtube repository, as shown in attached screenshot
          Hide
          Frédéric Massart added a comment -

          Hi Chris,

          thanks for testing the patch. The YouTube repository acts a bit differently than the other ones as it can only return external urls. Adding a YouTube video to your private files will not work. However, while adding a URL resource you should be able to browse the YouTube repository.

          If you experience some more troubles, could you please provide more information about the version of Moodle installed, activity used, etc... so that I can investigate the problems?

          Thank you.

          Show
          Frédéric Massart added a comment - Hi Chris, thanks for testing the patch. The YouTube repository acts a bit differently than the other ones as it can only return external urls. Adding a YouTube video to your private files will not work. However, while adding a URL resource you should be able to browse the YouTube repository. If you experience some more troubles, could you please provide more information about the version of Moodle installed, activity used, etc... so that I can investigate the problems? Thank you.
          Hide
          Chris Wharton added a comment -

          Thanks Frédéric, that makes sense. This patch works OK for me then.

          Show
          Chris Wharton added a comment - Thanks Frédéric, that makes sense. This patch works OK for me then.
          Hide
          Dan Poltawski added a comment -

          Integrated thanks Fred.

          Agreed about integrating to 2.1 since the regression was added there too, so in 21, 22, 23 and master.

          Show
          Dan Poltawski added a comment - Integrated thanks Fred. Agreed about integrating to 2.1 since the regression was added there too, so in 21, 22, 23 and master.
          Hide
          Jason Fowler added a comment -

          Testing instructions don't take into account that Google Docs repository now supports all file types in response to the release of Google Drive

          Show
          Jason Fowler added a comment - Testing instructions don't take into account that Google Docs repository now supports all file types in response to the release of Google Drive
          Hide
          Jason Fowler added a comment -

          other than a glitch with the google docs item in the instructions, this passes fine

          Show
          Jason Fowler added a comment - other than a glitch with the google docs item in the instructions, this passes fine
          Hide
          Dan Poltawski added a comment -

          asko, Дзякуй, ধন্যবাদ, Благодаря, Gràcies, 感谢, 謝謝, Hvala, Díky, Tak, Bedankt, Tänan, متشکریم, Salamat, Kiitokset, Merci, Grazas, Danke, Ευχαριστώ, આભાર, תודה, धन्यवाद, Köszönjük, Takk fyrir, Terima Kasih, Grazie, ありがとうございます, Рахмет, សូមអរគុណ, 감사합니다, gratiās, Pateicamies, Ačiū, Благодарам, Tēnā koa, Kia Ora Rawa Atu, आभारी आहोत, Талархал, Takk, Dziękuję, Obrigado, Mulţumesc, Engraziel, Спасибо, Fa'afetai, Хвала, Hvala, ස්තූතියි, Vďaka, Hvala, Mahadsanid, Thanks, Gracias, Tack, Salamat, நன்றி, నెనరులు, ขอบคุณค่ะ!

          Your work has made it into this weeks Moodle release! There are no gold medals available this week - but millions around the world will benefit. Thank you!

          Show
          Dan Poltawski added a comment - asko, Дзякуй, ধন্যবাদ, Благодаря, Gràcies, 感谢, 謝謝, Hvala, Díky, Tak, Bedankt, Tänan, متشکریم, Salamat, Kiitokset, Merci, Grazas, Danke, Ευχαριστώ, આભાર, תודה, धन्यवाद, Köszönjük, Takk fyrir, Terima Kasih, Grazie, ありがとうございます, Рахмет, សូមអរគុណ, 감사합니다, gratiās, Pateicamies, Ačiū, Благодарам, Tēnā koa, Kia Ora Rawa Atu, आभारी आहोत, Талархал, Takk, Dziękuję, Obrigado, Mulţumesc, Engraziel, Спасибо, Fa'afetai, Хвала, Hvala, ස්තූතියි, Vďaka, Hvala, Mahadsanid, Thanks, Gracias, Tack, Salamat, நன்றி, నెనరులు, ขอบคุณค่ะ! Your work has made it into this weeks Moodle release! There are no gold medals available this week - but millions around the world will benefit. Thank you!

            People

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

              Dates

              • Created:
                Updated:
                Resolved: