I’m uploading a file (DOCX) to Uploadcare, then sending a convert request to convert the file to a PDF.
When I fetch the converted file with a GET request the content-type
header is incorrectly set to application/octet-stream
. The file conversion is working correctly (I am able to download the PDF file and open it) but when I try to render it in a WebView (i.e. on iOS via Safari) the document is just rendered as a string of gibberish characters. I believe the WebView is attempting to render the PDF file data as a regular text string.
When I fetch the original file the content-type
header is set correctly.
I’ve tried fetching the converted file using the following URL schemas:
https://ucarecdn.com/${convertedFileUUID}/
https://ucarecdn.com/${originalFileUUID}/document/-/format/pdf/
-
https://ucarecdn.com/${convertedFileUUID}/document/-/format/pdf/
(gives a404
)
Does anybody have any ideas about how I can get the correct content-type
header for a converted (PDF) file?
Cross-posting Incorrect `content-type` header returned by Uploadcare converted file - Stack Overflow