Moodle
  1. Moodle
  2. MDL-33473

Non-JS filemanager can not pick files from moodle repositories

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.1, 2.2, 2.3
    • Fix Version/s: None
    • Component/s: Filepicker, Repositories
    • Labels:
      None
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Rank:
      41372

      Description

      when file is picked from recent files, the size is 0.

      To replicate:

      1. Turn off browser Javascript
      2. Add file resource a course
      3. In "select files" section, add a file from 'recent files'
      4. Choose 'download'
      5. On the list of selected file, click on the file name to download and notice the file size is 0.

        Issue Links

          Activity

          Hide
          Rossiani Wijaya added a comment -

          Please make sure MDL-33322 and MDL-33409 have been integrated before using any file/patch from this issue.

          Show
          Rossiani Wijaya added a comment - Please make sure MDL-33322 and MDL-33409 have been integrated before using any file/patch from this issue.
          Hide
          Marina Glancy added a comment -

          the same issue with any moodle repositories - local, user, recent, coursefiles

          Show
          Marina Glancy added a comment - the same issue with any moodle repositories - local, user, recent, coursefiles
          Hide
          Marina Glancy added a comment -

          This is my patch (after MDL-33322 but before MDL-33409).
          https://github.com/marinaglancy/moodle/compare/master...wip-nonjs
          It basically adds the following:

              if ($repo->has_moodle_files()) {
                  $filesize = $repo->get_file_size($fileurl);
                  if (($maxbytes !== -1) && !empty($filesize) && ($filesize > $maxbytes)) {
                      print_error('maxbytes');
                  }
                  $fileinfo = $repo->copy_to_area($fileurl, $itemid, $savepath, $filename);
                  redirect($home_url, get_string('downloadsucc', 'repository'));
              }
          

          please note that in MDL-33409 I changed arguments of repository::copy_to_area() function and basically deprecated repository::get_file_size() (instead copy_to_area throws an exception)

          Show
          Marina Glancy added a comment - This is my patch (after MDL-33322 but before MDL-33409 ). https://github.com/marinaglancy/moodle/compare/master...wip-nonjs It basically adds the following: if ($repo->has_moodle_files()) { $filesize = $repo->get_file_size($fileurl); if (($maxbytes !== -1) && !empty($filesize) && ($filesize > $maxbytes)) { print_error('maxbytes'); } $fileinfo = $repo->copy_to_area($fileurl, $itemid, $savepath, $filename); redirect($home_url, get_string('downloadsucc', 'repository')); } please note that in MDL-33409 I changed arguments of repository::copy_to_area() function and basically deprecated repository::get_file_size() (instead copy_to_area throws an exception)
          Hide
          Marina Glancy added a comment -

          This has probably been fixed in some other issue because it works fine now (tested on Moodle 2.5)

          Show
          Marina Glancy added a comment - This has probably been fixed in some other issue because it works fine now (tested on Moodle 2.5)

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: