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

tool_mobile_get_plugins_supporting_mobile generates incorrect fileurl on windows

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1.5, 3.2.2
    • Fix Version/s: 3.1.6, 3.2.3
    • Component/s: Web Services
    • Labels:
    • Environment:
      Windows and IIS
    • Testing Instructions:
      Hide
      1. Install Moodle on an IIS web server
      2. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      3. Create a Token for the student user:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      4. Next, you can do a CURL REST call simulating a WS client with the student user.
        • You need to replace the wstoken, and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=tool_mobile_get_plugins_supporting_mobile&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool"

      1. Confirm that: You see a list of empty warnings and plugins
      2. Now, install in Moodle the local_testservices plugin attached in issue MDL-54643
      3. Run again the CURL request and confirm that
        • You see now a returned plugin with the following information:

          "plugins":

          "addon": "remotetest",
          "component": "local_testservices",
          "dependencies": [],
          "filehash": "3959862d33e6bb932d5ce7220175eac546e04141",
          "filesize": 1373997,
          "fileurl": "YOUR_MOODLE_URL_/local/testservices/mobile/remotetest.zip",
          "version": "2016101202"
          ,

          "addon": "anothertest",
          "component": "local_testservices",
          "dependencies": [
          "remotetest"
          ],
          "filehash": "b0b221e62d11ae4257f3e39626193d2402b4593a",
          "filesize": 2751301,
          "fileurl": "YOUR_MOODLE_URL_/local/testservices/mobile/anothertest.zip",
          "version": "2016101202"

          ,
          "warnings": []

       

      Show
      Install Moodle on an IIS web server As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the student user: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student user. You need to replace the wstoken, and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=tool_mobile_get_plugins_supporting_mobile&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool" Confirm that: You see a list of empty warnings and plugins Now, install in Moodle the local_testservices plugin attached in issue  MDL-54643 Run again the CURL request and confirm that You see now a returned plugin with the following information: "plugins": "addon": "remotetest", "component": "local_testservices", "dependencies": [], "filehash": "3959862d33e6bb932d5ce7220175eac546e04141", "filesize": 1373997, "fileurl": "YOUR_MOODLE_URL_/local/testservices/mobile/remotetest.zip", "version": "2016101202" , "addon": "anothertest", "component": "local_testservices", "dependencies": [ "remotetest" ], "filehash": "b0b221e62d11ae4257f3e39626193d2402b4593a", "filesize": 2751301, "fileurl": "YOUR_MOODLE_URL_/local/testservices/mobile/anothertest.zip", "version": "2016101202" , "warnings": []  
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE
    • Pull from Repository:
    • Pull 3.1 Branch:
      MDL-58285-m31
    • Pull Master Branch:

      Description

      The tool_mobile_get_plugins_supporting_mobile does not seem to generate urls to remote Moodle Mobile plugins correctly when Moodle is running on IIS under Windows

      For example I get the following response:

      {"exception":"invalid_response_exception","errorcode":"invalidresponse","message":"Invalid response value detected","debuginfo":"plugins => Invalid response value detected: fileurl => Invalid response value detected: Invalid external api response: the value is \"http:\/\/localhost\/moodle32\/mod\/tutorialbooking\\mobile\\mod_tutorialbooking.zip\", the server was expecting \"url\" type"}

      Steps to reproduce

      Assumptions

      1. You have Moodle installed on IIS
      2. You have a plugin installed that includes a remote Moodle mobile addon
      3. You have a token for the webservice

      Steps

      1. Call the webservice: <path_to_moodle>/webservice/rest/server.php?moodlewsrestformat=json&wsfunction=tool_mobile_get_plugins_supporting_mobile&wstoken=<your_token>

      Result

      You will see an exception similar to the above, rather than the correct response detailing plugins.

      This means that remote Mobile plugins will not load for the site.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

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