Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Android: Fix uploading GIF URI (#45826)
Summary: In Android, when constructing a multipart body for a file and that file source is a uri (base64-encoded) we do the following: 1. Decode the base64 string into bytes 2. Create a bitmap object 3. Compress the bitmap object as PNG into new bytes The process does an unnecessary work (bytes -> bitmap -> bytes) and creates unexpected results e.g. a GIF file will be converted into PNG when uploaded. This PR removes the unnecessary steps (2 and 3). ## Changelog: [ANDROID] [FIXED] - Fix uploading GIF URI Pull Request resolved: #45826 Test Plan: 1. Upload a GIF; use URI (base64-encoded) 2. Verify that the uploaded file is a GIF ```js const formData = new FormData(); formData.append('photo', { uri: GIFURI, type: 'image/gif', name: 'photo.gif', }); fetch(UPLOAD_URL, { body: formData, method: "POST", }): ``` | Before | After | |:------:|:-----:| | <video src="https://github.com/user-attachments/assets/6ce4769a-8fa5-4d00-8066-9a1911608632" /> | <video src="https://github.com/user-attachments/assets/76a29d14-ce9d-48cd-94d0-7591064a5b1b" /> | Reviewed By: cortinico Differential Revision: D60515478 Pulled By: tdn120 fbshipit-source-id: d6ad1c42631c184c3dcdf3a956641e25d0c1b926
- Loading branch information