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

New offline parameter is not usable by webservice/pluginfile.php

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Setup the google repository and enable controlled links.

      Upload a new file resource to a course as a controlled link (don't use an existing file from before this patch). Make sure the display is set to embedded. Use one of the google formats (so you can verify it is converted for offline on the way out).

      Create a mobile token. ...

      View the file resource and check the source of the page to get the url for the iframe.

      e.g. https://damyon.per.in.moodle.com/integration_master/pluginfile.php/494/mod_resource/content/2/Alice%20PC.gsheet

      Copy everything after the pluginfile.php (/494/mod_resource/content/2/Alice%20PC.gsheet)

      In a terminal use wget to fetch the file via the webservices plugin file script.

      The url will be like this:

      wget --no-check-certificate "https://damyon.per.in.moodle.com/integration_master/webservice/pluginfile.php/494/mod_resource/content/2/Alice%20PC.gsheet?offline=true&token=bf15e4bbe1d6fb73c4dde9fba95cf44e"

      (Use the path from above and append the users token as well as the offline param).

      You should have downloaded a file. Rename it to the matching office file extension (e.g. .gsheet -> .xlsx). Try and open it.

      Show
      Setup the google repository and enable controlled links. Upload a new file resource to a course as a controlled link (don't use an existing file from before this patch). Make sure the display is set to embedded. Use one of the google formats (so you can verify it is converted for offline on the way out). Create a mobile token. ... View the file resource and check the source of the page to get the url for the iframe. e.g. https://damyon.per.in.moodle.com/integration_master/pluginfile.php/494/mod_resource/content/2/Alice%20PC.gsheet Copy everything after the pluginfile.php (/494/mod_resource/content/2/Alice%20PC.gsheet) In a terminal use wget to fetch the file via the webservices plugin file script. The url will be like this: wget --no-check-certificate "https://damyon.per.in.moodle.com/integration_master/webservice/pluginfile.php/494/mod_resource/content/2/Alice%20PC.gsheet?offline=true&token=bf15e4bbe1d6fb73c4dde9fba95cf44e" (Use the path from above and append the users token as well as the offline param). You should have downloaded a file. Rename it to the matching office file extension (e.g. .gsheet -> .xlsx). Try and open it.
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-58800-master

      Description

      There are two different problems here:
      1 - It seems that when the offline parameter is set, the googledocs repository will try to download the file using the current user google oauth token (it should use the system one when web services are used or even always because maybe there is not an active google session in the user browser)
      2 - webservice/pluginfile.php is defined as an AJAX script, this means that redirections won't work so when send_file does a redirection to the real file in the google doc repository, we receive a redirectionerror exception (check the redirect function in lib/weblib.php)

        Attachments

          Activity

            People

            • Assignee:
              damyon Damyon Wiese
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Juan Leyva
              Integrator:
              Dan Poltawski
              Tester:
              Dani Palou
              Participants:
              Component watchers:
              Adrian Greeve, Mihail Geshoski, Peter Dias, Juan Leyva, Jake Dallimore, Jun Pataleta, Ryan Wyllie
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/May/17