From 48669af562d6d3ed7835816d60a2fb400a22a19b Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Thu, 1 Aug 2024 12:04:42 -0700 Subject: [PATCH] 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: https://github.com/facebook/react-native/pull/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 | |:------:|:-----:| |