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

Incorrect text-formatting in Web Services that returns module information

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6.3, 3.7, 3.8
    • Fix Version/s: 3.6.7, 3.7.3
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Ensure that the site has the "Enable trusted content" setting enabled
      3. Create a course and add a quiz activity and page resource, in the resource/activity description field please add the following html content "<button>This is a button</button>"
      4. Create a Token in the mobile app service for one user enrolled in the previous course (not an admin account)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours and the course id.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=2&wsfunction=mod_quiz_get_quizzes_by_courses&wstoken=3af67232a7596ceb658df4db329e5ad6&moodlewssettingfilter=true' | python -m "json.tool"

      6. Confirm that the "intro" field returned contains the HTML code used in the description: <button>This is a button</button>
      7. Now, execute the following curl requests (doing the required replacements) this time for the page resource

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=2&wsfunction=mod_page_get_pages_by_courses&wstoken=3af67232a7596ceb658df4db329e5ad6&moodlewssettingfilter=true' | python -m "json.tool"

      8. Confirm that the "intro" field returned contains the HTML code used in the description: <button>This is a button</button>
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Ensure that the site has the "Enable trusted content" setting enabled Create a course and add a quiz activity and page resource, in the resource/activity description field please add the following html content "<button>This is a button</button>" Create a Token in the mobile app service for one user enrolled in the previous course (not an admin account) Click on Site administration ► Plugins ► Web services ► Manage tokens Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours and the course id. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=2&wsfunction=mod_quiz_get_quizzes_by_courses&wstoken=3af67232a7596ceb658df4db329e5ad6&moodlewssettingfilter=true' | python -m "json.tool" Confirm that the "intro" field returned contains the HTML code used in the description: <button>This is a button</button> Now, execute the following curl requests (doing the required replacements) this time for the page resource curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=2&wsfunction=mod_page_get_pages_by_courses&wstoken=3af67232a7596ceb658df4db329e5ad6&moodlewssettingfilter=true' | python -m "json.tool" Confirm that the "intro" field returned contains the HTML code used in the description: <button>This is a button</button>
    • Affected Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE
    • Pull from Repository:
    • Pull 3.6 Branch:
    • Pull 3.7 Branch:
    • Pull Master Branch:
      MDL-65026-master

      Description

      The Web Service seems to be doing excessive text cleaning, it seems that the text formatting is not consistent.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Nov/19

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours
                4h