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

          Issue Links

            Activity

            Hide
            chrisw Chris Wharton added a comment -
            Show
            chrisw Chris Wharton added a comment - Discussion here: http://moodle.org/mod/forum/discuss.php?d=207664
            Hide
            fred 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
            fred 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 Marina Glancy added a comment -

            Looks fine for me

            Show
            marina Marina Glancy added a comment - Looks fine for me
            Hide
            nebgor 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
            nebgor 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
            chrisw Chris Wharton added a comment -

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

            Show
            chrisw Chris Wharton added a comment - This patch doesn't appear to work for the Youtube repository, as shown in attached screenshot
            Hide
            fred 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
            fred 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
            chrisw Chris Wharton added a comment -

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

            Show
            chrisw Chris Wharton added a comment - Thanks Frédéric, that makes sense. This patch works OK for me then.
            Hide
            poltawski 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
            poltawski 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
            phalacee 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
            phalacee 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
            phalacee Jason Fowler added a comment -

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

            Show
            phalacee Jason Fowler added a comment - other than a glitch with the google docs item in the instructions, this passes fine
            Hide
            poltawski 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
            poltawski 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:
                  Fix Release Date:
                  10/Sep/12