mobile_api_json_reply sends extra stuff at the top, making it invalid json

Bug #1268788 reported by Hugh Davenport on 2014-01-13
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
High
Leo Xiong
1.8
High
Robert Lyon

Bug Description

An example is this, using the wrong api token

D/RestClient( 2917): Response = <form name="jsdetector_form" id="jsdetector_form" method="post">
D/RestClient( 2917): <input name="javascriptenabled" type="hidden" value="true" />
D/RestClient( 2917): <script type="text/javascript">
D/RestClient( 2917): document.jsdetector_form.submit();
D/RestClient( 2917): </script>
D/RestClient( 2917): </form>{"fail":"Sorry that mobile upload token was not found. Please check your site and mobile application settings."}

Stolen from a maharadroid with a patch to log the responses, but that can be obtained with easier ways.

Just need to find the jsdectector stuff and make sure it isn't done in a part of mahara that has json reply in it. This may actually break some of the json stuff as well? or the /api/mobile/sync.php needs a define of JSON at the top.

tags: added: maharadroid
Leo Xiong (leoxiong) on 2014-01-14
Changed in mahara:
status: Triaged → Opinion
status: Opinion → New
Leo Xiong (leoxiong) on 2014-01-14
Changed in mahara:
status: New → In Progress
assignee: nobody → Leo Xiong (hello-w)
Aaron Wells (u-aaronw) wrote :

I should really put together some documentation on the wiki, of all the different page-top constants we use...

Reviewed: https://reviews.mahara.org/2911
Committed: http://gitorious.org/mahara/mahara/commit/4eb4e184586422a7567f5f5693bdef0d4ab790bf
Submitter: Aaron Wells (<email address hidden>)
Branch: master

commit 4eb4e184586422a7567f5f5693bdef0d4ab790bf
Author: Leo Xiong <email address hidden>
Date: Tue Jan 14 16:34:01 2014 +1300

Added define('JSON', 1) and define('NOSESSKEY') to remove jsdetector and the requirement of a session key from api/mobile/sync.php and also upload.php. bug #1268788

Change-Id: I87d304e7ed80ad62c697b7578f84e3a7155a440b
Signed-off-by: Leo Xiong <email address hidden>

Aaron Wells (u-aaronw) on 2014-01-14
Changed in mahara:
status: In Progress → Fix Committed

Reviewed: https://reviews.mahara.org/2944
Committed: http://gitorious.org/mahara/mahara/commit/1a5d395cdb87a7e2ae14f251a562315f5ace87c6
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 1a5d395cdb87a7e2ae14f251a562315f5ace87c6
Author: Aaron Wells <email address hidden>
Date: Tue Jan 21 14:39:42 2014 +1300

Revert "Add class JavascriptDetector for checking if javascript is enabled"

This reverts commit 1cdc0486e956fbc4e2e1a10f50818156aece16ce.

The JSDetector class has caused three regressions so far (Bug 1270846,
Bug 1261610, and Bug 1268788). Since it's been buggy and it's not
actively in use anywhere in the site, I think we should revert it.

Change-Id: If32d5adf8733ce3f455aab09a5d138c7707ae95d

Reviewed: https://reviews.mahara.org/3155
Committed: http://gitorious.org/mahara/mahara/commit/a1ac59ae8179f01fa3edca4ecb4df7228e245d63
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.8_STABLE

commit a1ac59ae8179f01fa3edca4ecb4df7228e245d63
Author: Leo Xiong <email address hidden>
Date: Tue Jan 14 16:34:01 2014 +1300

Added define('JSON', 1) and define('NOSESSKEY') to remove jsdetector and the requirement of a session key from api/mobile/sync.php and also upload.php. bug #1268788

Change-Id: I87d304e7ed80ad62c697b7578f84e3a7155a440b
Signed-off-by: Leo Xiong <email address hidden>

Robert Lyon (robertl-9) on 2014-04-22
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers