magicbug / Cloudlog

Web based amateur radio logging application built using PHP & MySQL supports general station logging tasks from HF to Microwave with supporting applications to support CAT control.
http://www.cloudlog.co.uk
MIT License
460 stars 190 forks source link

QSO API is providing a 201 instead of an error with incorrect station callsign #2464

Closed f4iha closed 1 year ago

f4iha commented 1 year ago

Describe the bug Import of a QSO with an incorrect station callsign is providing a 201 instead of an error with the associated error message.

To Reproduce

curl -X POST -d '{"key":"REDACTED","station_profile_id":"3","type":"adif","string":"<call:5>F4AAA <gridsquare:4>JN20 <mode:3>FT8 <rst_sent:0> <rst_rcvd:0> <qso_date:8>20230904 <time_on:6>224345 <qso_date_off:8>20230904 <time_off:6>224345 <band:0> <freq:8>0.000857 <station_callsign:7>F4IHA/P <my_gridsquare:6>JN26 <tx_pwr:2>3W <comment:3>FT8<eor>"}'  http://my_server/index.php/api/qso
{"status":"created","type":"adif","string":"<call:5>F4AAA <gridsquare:4>JN20 <mode:3>FT8 <rst_sent:0> <rst_rcvd:0> <qso_date:8>20230904 <time_on:6>224345 <qso_date_off:8>20230904 <time_off:6>224345 <band:0> <freq:8>0.000857 <station_callsign:7>F4IHA\/P <my_gridsquare:6>JN26 <tx_pwr:2>3W <comment:3>FT8<eor>"}

Expected behaviour Having the error message which is displayed as output of the API

Additional context The issue is when the import function in the Logbook_model.php is making a return but the message is not handled in the API return

phl0 commented 1 year ago

Fix proposed in https://github.com/magicbug/Cloudlog/pull/2465. Please test and report.