Moodle
  1. Moodle
  2. MDL-31499

"Download all" in Privates files failed with javascript error (IE 8 & 9)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Files API
    • Labels:
    • Environment:
      Windows 2008 Server, IIS 7.5, PHP 5.3.2, MySQL 5.1.58
    • Database:
      MySQL
    • Testing Instructions:
      Hide

      Requisites:

      1. Go to your private files, upload a couple of files and save.
      2. To be tested on all supported browsers

      Test steps:

      1. Go to your private files, click on download all
      2. Make sure the file can be downloaded
      Show
      Requisites: Go to your private files, upload a couple of files and save. To be tested on all supported browsers Test steps: Go to your private files, click on download all Make sure the file can be downloaded
    • Workaround:
      Hide

      Don't use IE....

      Show
      Don't use IE....
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-31499-master-iframe
    • Rank:
      38037

      Description

      When using IE (tested with version 8 & 9), users cannot use the "Dowload all" button in the Privates files. They got a javascript error "invalid argument" instead of the usual download pop-up. This works well however with Firefox or Chrome.

      Replication steps:

      1. User is admin
      2. Add a private files block
      3. Click "Manage my privates files"
      4. Upload a file
      5. Click button "Download all"

      The progress icon appear but seem to reset in loop.

      A javascript error icon shows up in the corner, with this detail:

      Détails de l'erreur de la page Web
      
      Agent utilisateur : Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E; BRI/2)
      Horodateur : Fri, 3 Feb 2012 21:42:17 UTC
      
      (the error bellow occur many time in loop)
      
      Message : Argument non valide.
      Ligne : 15
      Caractère : 168
      Code : 0
      URI : http://xyz.com/lib/javascript.php?file=%2Flib%2Fform%2Ffilemanager.js&rev=479
      

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          Thanks for reporting that.

          I was able to replicate the problem. The error repeated in IE9 was...

          SCRIPT87: Invalid argument. 
          javascript.php?file=%2Flib%2Fform%2Ffilemanager.js&rev=322, line 14 character 168
          

          According to the debugging console, this is the offending command...

          var win=window.open(obj.fileurl,'fm-download-folder');
          

          I concur with your workaround

          Show
          Michael de Raadt added a comment - Thanks for reporting that. I was able to replicate the problem. The error repeated in IE9 was... SCRIPT87: Invalid argument. javascript.php?file=%2Flib%2Fform%2Ffilemanager.js&rev=322, line 14 character 168 According to the debugging console, this is the offending command... var win=window.open(obj.fileurl,'fm-download-folder'); I concur with your workaround
          Hide
          Yvonne Hamilton added a comment -

          We cannot 'download all' files (when editing the resources) from the 'legacy course files' or from an activity such as 'Hot Potato' or from a folder so i think it is a little more wide spread than just the private files area. We are using Moodle 2.1.3 IE8. Individual files are fine to download.

          Webpage error details

          Message: Invalid argument.
          Line: 15
          Char: 168
          Code: 0
          URI: http://anyone.anywhere.ac.nz/lib/javascript.php?file=%2Flib%2Fform%2Ffilemanager.js&rev=164

          Regards,
          Yvonne

          Show
          Yvonne Hamilton added a comment - We cannot 'download all' files (when editing the resources) from the 'legacy course files' or from an activity such as 'Hot Potato' or from a folder so i think it is a little more wide spread than just the private files area. We are using Moodle 2.1.3 IE8. Individual files are fine to download. Webpage error details Message: Invalid argument. Line: 15 Char: 168 Code: 0 URI: http://anyone.anywhere.ac.nz/lib/javascript.php?file=%2Flib%2Fform%2Ffilemanager.js&rev=164 Regards, Yvonne
          Hide
          Paul Holden added a comment -

          Hi Michael et al,

          I've created a branch on my github that fixes this, the problem is that IE is fussy about the second parameter to window.open; https://github.com/paulholden/moodle/compare/master...MDL-31499

          See http://stackoverflow.com/a/4681766 for reference

          Show
          Paul Holden added a comment - Hi Michael et al, I've created a branch on my github that fixes this, the problem is that IE is fussy about the second parameter to window.open; https://github.com/paulholden/moodle/compare/master...MDL-31499 See http://stackoverflow.com/a/4681766 for reference
          Hide
          Michael de Raadt added a comment -

          Thanks for your involvement, Yvonne and Paul.

          Show
          Michael de Raadt added a comment - Thanks for your involvement, Yvonne and Paul.
          Hide
          Frédéric Massart added a comment -

          The patch from Paul works beautifully and can be pulled directly from his repository:

          git://github.com/paulholden/moodle.git
          MDL-31499
          https://github.com/paulholden/moodle/compare/master...MDL-31499
          

          But, IE8 behaves a bit strangely on my system as it opens the popup but closes it straight away without offering me to download the file. And as in Firefox the popup was blocked, I thought about another solution using iframes.

          Waiting for your review!

          Show
          Frédéric Massart added a comment - The patch from Paul works beautifully and can be pulled directly from his repository: git://github.com/paulholden/moodle.git MDL-31499 https://github.com/paulholden/moodle/compare/master...MDL-31499 But, IE8 behaves a bit strangely on my system as it opens the popup but closes it straight away without offering me to download the file. And as in Firefox the popup was blocked, I thought about another solution using iframes. Waiting for your review!
          Hide
          Dan Poltawski added a comment -

          The patch looks good.

          One question which stems from it is why we used a popup in the first place. One thing which came to mind was whether it was related to forcedownload options or something like that?

          I don't think its related to that, but I am not 100% up to speed with windows client side web security issues which forcedownload. So I have added Petr here to tell me if in case i'm wrong.

          Show
          Dan Poltawski added a comment - The patch looks good. One question which stems from it is why we used a popup in the first place. One thing which came to mind was whether it was related to forcedownload options or something like that? I don't think its related to that, but I am not 100% up to speed with windows client side web security issues which forcedownload. So I have added Petr here to tell me if in case i'm wrong.
          Hide
          Frédéric Massart added a comment -

          Pushing to integration as appear to be reviewed

          Show
          Frédéric Massart added a comment - Pushing to integration as appear to be reviewed
          Hide
          Aparup Banerjee added a comment -

          thanks, this has been integrated into master only.

          works for me in ff, chrome, ie8 but more testing welcome.

          affects version is 2.2.1 (have removed) but this has a mdlqa so i'm integrating this to expedite release process.

          Fred will be creating a backport issue for 2.2.x as this fix hasn't been tried on 2.2.

          Show
          Aparup Banerjee added a comment - thanks, this has been integrated into master only. works for me in ff, chrome, ie8 but more testing welcome. affects version is 2.2.1 (have removed) but this has a mdlqa so i'm integrating this to expedite release process. Fred will be creating a backport issue for 2.2.x as this fix hasn't been tried on 2.2.
          Hide
          Rajesh Taneja added a comment -

          Thanks for fixing this Fred

          Works well on IE8, IE9, opera, FF and chrome.

          Show
          Rajesh Taneja added a comment - Thanks for fixing this Fred Works well on IE8, IE9, opera, FF and chrome.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Big thanks for the effort. This is now part of Moodle upstream. Let's wait for regressions, yay! LOL

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Big thanks for the effort. This is now part of Moodle upstream. Let's wait for regressions, yay! LOL Ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: