I'm using the Link object type to send my users directly to JPGs, PDFs, external websites, and animated GIFs.
When the user clicks on the button, I open the URL in a new window with: window.open(data.media_link.url, "_new");
This works great with most media types, but it's not linking to the animated GIFs because it appends "myImage.gif?auto=compress,format" to the end of the URL, and this compresses the file, removing all animation.
So the only way to do it is with a string replace String.replace('.gif?auto=compress,format', '.gif') ?
Yes, that's correct.
Can't I add something to my request to Prismic API to stop appending these parameters?
We've looked into this, and last year we started testing a solution, but we encountered issues. For now, that solution is on hold without no timeline to proceed. However, if you want, you could post this as a feature request in the features category to show your support and invite others to do the same.