View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
17674Bug reportsMenu systempublic2021-12-01 09:28
Reportermikemacgherl Assigned Togabrieljenik  
PrioritynoneSeverityminor 
Status closedResolutionfixed 
Product Version5.x 
Summary17674: Impossible to add new Menu or New Menu Entry
DescriptionWhen accessing Settings -> Survey Menu the New Menu and New Menu Entry from the Survey Menu Entries tab give both a 400 error
Steps To ReproduceSteps to reproduce
------------------------------
Go to Survey Menu from Settings, click on New Menu

Expected result
-------------------------
The New Menu form opens up

Actual result
-----------------
The page goes grey: in the console from the developers tools in Chrome I get: Failed to load resource: the server responded with a status of 400 ()
If I click on the right URL https://liceoberchet.edu.it/limesurvey/index.php?r=admin/menuentries/sa/getsurveymenuentryform I get the screen I attach

Steps to reproduce
------------------------------
Go to Survey Menus form Settings, choose the Survey Menu Entries tab
Click on New Menu Entry button in the upper left corner

Expected Result
-------------------------
The New Menu Entry form pops up

Actual Result
-----------------------
I get the error in the .log file attached


TagsNo tags attached.
Bug heat8
Complete LimeSurvey version number (& build)5.1.14+210927
I will donate to the project if issue is resolvedYes
BrowserGoogle Chrome 94.0.4606.81
Database type & versionMysql 8.0.23
Server OS (if known)Linux bigserver 5.4.57-smp #1 SMP Fri Aug 7 13:05:31 CDT 2020 i686 Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz GenuineIntel GNU/Linux
Webserver software & version (if known)Nginx 1.18.0
PHP Version7.4.15

Users monitoring this issue

User List mikemacgherl

Activities

mikemacgherl

mikemacgherl

2021-10-21 21:00

reporter  

bigserver-1634841977692.log (941 bytes)   
jquery-migrate-3.3.2.min.js:2 JQMIGRATE: Migrate is installed, version 3.3.2
adminbasics.min.js:1 AdminCore TRIGGERWARNING Document ready triggered
adminbasics.min.js:1 AdminCore ConfirmationModal calling
pjax.combined.min.js:1 PJAX options {elements: Array(2), selectors: Array(4), debug: false, forceRedirectOnFail: true, reRenderCSS: true, …}
adminbasics.min.js:1 AdminCore Triggering panel animation
jquery-3.5.1.min.js:2 POST https://liceoberchet.edu.it/limesurvey/index.php?r=admin/menuentries/sa/getsurveymenuentryform 400
send @ jquery-3.5.1.min.js:2
ajax @ jquery-3.5.1.min.js:2
s.ajax.s.ajax @ jquery-migrate-3.3.2.min.js:2
S.fn.load @ jquery-3.5.1.min.js:2
s.fn.<computed> @ jquery-migrate-3.3.2.min.js:2
_editCreateModal @ surveymenufunctionswrapper.min.js:1
runCreateModal @ surveymenufunctionswrapper.min.js:1
(anonimo) @ surveymenufunctionswrapper.min.js:1
dispatch @ jquery-3.5.1.min.js:2
v.handle @ jquery-3.5.1.min.js:2
bigserver-1634841977692.log (941 bytes)   
gabrieljenik

gabrieljenik

2021-11-05 20:22

manager   ~67149

PR: https://github.com/LimeSurvey/LimeSurvey/pull/2136

Recently, seems it has been changed how the token is set on AJAX calls.
Before, the ajaxSetup() methos was used.
Now, the beforeSend callback is used.

The problem is with the contentType, which is set to text/plain.
Why? Because at the time that is set, during ajaxSetup, the there was no payload, defaulting to text/plain.

Solution, is a bit wide.

Use $.ajaxPrefilter() instead of $.ajaxSetup({beforeSend: ...}) to add the CSRF token because beforeSend is
executed after the content type is determined. So, if the request had no data when beforeSend is executed,
the content type is 'text/plain', which is wrong.
mikemacgherl

mikemacgherl

2021-11-06 00:20

reporter   ~67150

Last edited: 2021-11-16 17:03

I can confirm that it works smothlessly.
Are there any chances that this will go to the Master branch?
gabrieljenik

gabrieljenik

2021-11-15 09:39

manager   ~67323

Last edited: 2021-11-16 17:03

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=32960
c_schmitz

c_schmitz

2021-12-01 09:28

administrator   ~67627

New version released

Related Changesets

LimeSurvey: master 9941ccf8

2021-11-15 09:39:26

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 17674: Impossible to add new Menu or New Menu Entry (#2136)

* Fixed issue 17674: Impossible to add new Menu or New Menu Entry

* Fixed issue 17674: Impossible to add new Menu or New Menu Entry

- Add comments

Co-authored-by: encuestabizdevgit <devgit@encuesta.biz>
Affected Issues
17674
mod - application/extensions/LimeScript/LimeScript.php Diff File

Issue History

Date Modified Username Field Change
2021-10-21 21:00 mikemacgherl New Issue
2021-10-21 21:00 mikemacgherl File Added: bigserver-1634841977692.log
2021-10-21 21:00 mikemacgherl File Added: Immagine 2021-10-21 205450.png
2021-10-21 21:03 mikemacgherl Issue Monitored: mikemacgherl
2021-10-21 21:03 mikemacgherl Bug heat 0 => 2
2021-11-02 09:15 c_schmitz Steps to Reproduce Updated View Revisions
2021-11-02 15:20 galads Assigned To => gabrieljenik
2021-11-02 15:20 galads Status new => assigned
2021-11-05 20:22 gabrieljenik Note Added: 67149
2021-11-05 20:22 gabrieljenik Bug heat 2 => 4
2021-11-06 00:20 mikemacgherl Note Added: 67150
2021-11-06 00:20 mikemacgherl Bug heat 4 => 6
2021-11-15 09:39 gabrieljenik Changeset attached => LimeSurvey master 9941ccf8
2021-11-15 09:39 gabrieljenik Note Added: 67323
2021-11-15 09:39 gabrieljenik Resolution open => fixed
2021-11-16 17:03 c_schmitz Status assigned => resolved
2021-12-01 09:28 c_schmitz Note Added: 67627
2021-12-01 09:28 c_schmitz Bug heat 6 => 8
2021-12-01 09:28 c_schmitz Status resolved => closed