emfcamp / Website

The Electromagnetic Field web site
http://www.emfcamp.org
GNU Affero General Public License v3.0
41 stars 83 forks source link

Bug: error unsetting `video_recording_lost` flag via API #1771

Closed jayaddison closed 1 month ago

jayaddison commented 1 month ago

To replicate the error:

$ curl -H 'Content-Type: application/json' -H 'Authorization: Bearer video-api-token' -XPATCH http://127.0.0.1:2342/api/proposal/2 --data '{"video_recording_lost": false}'

Expected:

Actual:

Cause:

The falsy-fallback evaluation below (false or "") emits a str value, and that causes a type mismatch when attempting to write to the db.Boolean video_recording_lost database column:

https://github.com/emfcamp/Website/blob/888fb8b7d63c7560376bc2d5670b0e46f61fdce0/apps/api/schedule.py#L55

Relates: