This mostly reverts commit fc5156cc. This also fixes a use-after-free bug.
Attach a file by drag & drop or click to upload