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

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

XMLWordPrintable

    • MOODLE_33_STABLE
    • MOODLE_33_STABLE
    • MDL-58800-master
    • 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.

      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)

            damyon Damyon Wiese
            jleyva Juan Leyva
            Juan Leyva Juan Leyva
            Dan Poltawski Dan Poltawski
            Dani Palou Dani Palou
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.