Web IDE mangles some images uploaded
Summary
Some (not all) images uploaded through Web IDE are mangled. Apparently this happened due to the fix in !44699 (merged)
Steps to reproduce
- Upload a JPEG image in the Web IDE
- Commit your changes
- The changes will be mangled.
Happens only on Chrome
Example Project
gitlab-com/www-gitlab-com!65367 (fe63b8a4)
What is the current bug behavior?
Images render fine in the preview pane before commit, but get mangled after commit.
What is the expected correct behavior?
Images should render fine before and after commit.
Possible fixes
In !44699 (merged), we use btoa
to encode image/binary content and upload. This is an unreliable approach. Instead we should fetch the blob and get its base64 contents.
Edited by Himanshu Kapoor