I am able to replace a jpg with another jpg using the Replace API call.
I want to replace a jpg wtih a webp file, which should be fine as they both have the same type (IMG). But when I upload the file (test_file.webp) with a .webp file extension I get a 400 error (weird error number, would 415 make more sense).
But, if I upload the exact same webp file, but put the file name as test_file.jpg it works fine! Yes the binary contents are webp, but the file extension is .jpg. When I view the file in the Files portal, it shows up with a .jpg extension, but displays fine.
I get the same result using both of these endpoints:
PUT /files/v3/files/{fileId}
POST /filemanager/api/v3/files/:file_id/replace
Why can't I replace an IMG file with another IMG file? Is this a bug? I mean I am able to rename a file, and I don't have to change the references in my Landing pages... so the system should be able to handle a different extension if the type doesn't change.
Unable to replace JPG with WebP file if I use the .webp file extension
The main reason is that webp files are way smaller. In my testing around 5-10x small, and when rendered in a webpage. Before creating this upload tool we were servring up an 8MB homepage, and have cut that by more than half after switching to webp.