View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
13794Bug reportsRemoteControlpublic2018-06-27 15:29
Reporteraaskoura Assigned Toollehar  
PrioritynoneSeverityminor 
Status closedResolutionfixed 
Product Version3.10.x 
Summary13794: RPC add_response reports error, still inserts a response record
Description

RPC add_response setting a file_upload field using format [{ "title":"...","comment":"...","size":"...","name":"...","filename":"{file_name}","ext":"..."}]
will report an error if the file doesn't exist in tmp folder "Unable to move files ...\/tmp\/upload\/{file_name} ...\/surveys\/{sid}\/files\/{file_name}"

Yet, it will create a record in response table
Is it possible to change this error into a warning? since the record is inserted anyways

Steps To Reproduce

Using Postman

{"method": "get_session_key", "params": [ "string_username","string_password" ], "id": 1}
returns
{"id":1,"result":"string_session_key","error":null}

{"method": "add_response", "params": [ "string_session_key",integer_sid,{"481151X46X1243":"Any Text", "481151X46X1244":"[{ \"title\":\"\",\"comment\":\"\",\"size\":\"100\",\"name\":\"file.png\",\"filename\":\"futmp_file_png\",\"ext\":\"png\"}]"}], "id": 1}
returns
{"id":1,"result":{"status":"Unable to move files ...\/tmp\/upload\/futmp_file_png ...\/upload\/surveys\/481151\/files\/futmp_file_png"},"error":null}
checking the survey responses, the record was actually inserted successfully

Additional Information

screenshot and .lss file attached

TagsNo tags attached.
Attached Files
Bug heat8
Complete LimeSurvey version number (& build)3.12.1+ 180616
I will donate to the project if issue is resolvedNo
BrowserPostman (REST client)
Database type & versionMySQL 5
Server OS (if known)Ubuntu 14 TLS
Webserver software & version (if known)Apache 2
PHP Version7.0.30

Users monitoring this issue

There are no users monitoring this issue.

Activities

Mazi

Mazi

2018-06-20 09:09

updater   ~48237

Hej Olle, this is the outstanding error report I mentioned at https://bugs.limesurvey.org/view.php?id=13738#c48116. Can you please look into this since it is causing quite some issues with our OfflineSurveys app?
It would already help if we change this from an error into a warning.

Thanks!

ollehar

ollehar

2018-06-21 11:06

administrator   ~48255

I'll have a look now.

ollehar

ollehar

2018-06-21 11:11

administrator   ~48257

What kind information would you like in the warning message? The result id?

ollehar

ollehar

2018-06-21 11:11

administrator   ~48258

I can return

array(
'status' => "Unable to move file ...',
'result_id' => $result_id
);

DenisChenu

DenisChenu

2018-06-21 12:14

developer   ~48261

If response was created : must return the id and only the id : see API https://api.limesurvey.org/classes/remotecontrol_handle.html#method_add_response

Else : updating API : need a 4.X version.

I always think it's best if all remote_control action was rewrited to ALWAYS return an array with status=>'(error|warning|result)' and the needed result in another var.

Can be done in API update but not without …

ollehar

ollehar

2018-06-21 14:50

administrator   ~48262

@DenisChenu I agree with your final solution, but not sure what to do until then. I think I will go with my suggestion above for now, with a "TODO" note...

ollehar

ollehar

2018-06-21 14:53

administrator   ~48263

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

c_schmitz

c_schmitz

2018-06-27 15:29

administrator   ~48337

Version 3.12.3+180627 released

Related Changesets

LimeSurvey: master 09b03e2a

2018-06-21 14:52:57

ollehar

Details Diff
Fixed issue 13794: RPC add_response reports error, still inserts a response record Affected Issues
13794
mod - application/helpers/remotecontrol/remotecontrol_handle.php Diff File

Issue History

Date Modified Username Field Change
2018-06-19 20:31 aaskoura New Issue
2018-06-19 20:31 aaskoura File Added: limesurvey_survey_481151.lss
2018-06-19 20:31 aaskoura File Added: Screen Shot 2018-06-19 at 20.15.10.png
2018-06-20 09:07 Mazi Assigned To => ollehar
2018-06-20 09:07 Mazi Status new => assigned
2018-06-20 09:09 Mazi Note Added: 48237
2018-06-21 11:06 ollehar Note Added: 48255
2018-06-21 11:11 ollehar Note Added: 48257
2018-06-21 11:11 ollehar Note Added: 48258
2018-06-21 12:14 DenisChenu Note Added: 48261
2018-06-21 14:50 ollehar Note Added: 48262
2018-06-21 14:53 ollehar Changeset attached => LimeSurvey master 09b03e2a
2018-06-21 14:53 ollehar Note Added: 48263
2018-06-21 14:53 ollehar Resolution open => fixed
2018-06-21 15:00 ollehar Status assigned => resolved
2018-06-27 15:29 c_schmitz Note Added: 48337
2018-06-27 15:29 c_schmitz Status resolved => closed