Backported image upload fix for 23.08
Adding more than two attachments no longer disappear mysteriously, and fix the spacing, so it does not overflow past the text area.
(cherry picked from commit 4052822a)
From !318 (merged) but we only need the bugfix for this version.