Richard, after having the same issues with Moodle 3.5.5+ I found this tracker that seems to explain the cause of this problem:
https://tracker.moodle.org/browse/MDL-65218?attachmentViewMode=list
https://tracker.moodle.org/browse/MDL-65218?attachmentViewMode=list