I am currently working on a React app which uploads user images to an Amazon S3 server, processes these images into a GIF on the python backend, and returns an Amazon S3 link to this newly-generated GIF back to React.
When the GIF is ready, React will show an tag to allow the user to download it:
<a href={urlToGif.current} download>Download Your GIF</a>
Where urlToGif.current is something like servername.s3.amazonaws.com/filename.gif
Clicking on this link successfully downloads some file with the correct filename. However, when attempting to open this file with Mac Preview, I get a "The file could not be opened" error message (Mac Preview normally supports opening .gif files).
Also, if I drag and drop the local downloaded file into Firefox, I similarly get a "The image cannot be displayed because it contains errors" message. However, no information is provided regarding what the errors are specifically.
I double checked the Amazon S3 url I provide to the href above. If I copy it from the DOM element itself, and paste it directly into a new browser tab, it takes me to the gif which displays correctly, and I am able to save the file as .gif from there with no problem.
I also removed the https:// prefix from the url to avoid cross origin issues and am not seeing any errors in my console at any point during the GIF generation process.
I do display the image url returned from my python backend on the page before download, and it renders the GIF as expected, so I'm fairly certain it's not an issue with how I'm creating the image itself.
My hunch is that there may be something wrong with the URL or how I'm accessing it. I've been researching this for a couple days now and have been unable to find a solution. Is anyone familiar with this issue and can point me to a potential root cause?