Fix fatal error in REST API response when an image has no attachment metadata.#568
Fix fatal error in REST API response when an image has no attachment metadata.#568felixarntz merged 2 commits intotrunkfrom
Conversation
… checking sizes
felixarntz
left a comment
There was a problem hiding this comment.
@mehulkaklotar Fix generally looks reasonable, but please add a unit test for the bug, so that we can verify it is fixed.
In the test, you can use the rest_prepare_attachment to e.g. make $data['media_details'] an object. With that test, we should then verify whether the old code would fail vs the new code would pass.
…ponse when metadata is not present
|
@felixarntz I have added the new unit test for checking I have used the REST controller's |
felixarntz
left a comment
There was a problem hiding this comment.
@mehulkaklotar Thank you, the test looks excellent!
Summary
This bug is very unlikely to happen as it depends on attachment metadata. It is assumed that metadata should always be present for the attachment but when metadata is deleted from DB, we should ensure proper error handling by checking the data from REST.
Fixes #567
Relevant technical choices
Added more checks for
media_detailsin response of REST API for attachmentsChecklist
[Focus]orInfrastructurelabel.[Type]label.no milestonelabel.