How do we handle PDFs in storage/localfile?
I have a custom data loader that loads PDFs. I now want to download the original file using the download icon:
I am getting redirected to something like:
/storage/localfile/bd/01/e58c84186e7ef623/attachments, and download not working.
Did a quick test loading a PDF through the ZIP dataloader plugin. The PDF was stored as
.pdf file in
/storage/localfile/ and downloading works just fine.
Any ideas what I am missing here?
You are probably mapping the file name (using
--map-file-name or the equivalent UI setting). It looks like an issue with that file name mapping. Specifically I would guess that the data loader plugin is outputting the file name as “attachments” instead of e.g. “attachments.pdf”.
From then on the MIME type is incorrectly mapped as plain text, which may cause a download issue depending on browser settings.
Thanks Patrice, you nailed it!
.pdf caused the trouble. Ensuring that now in my custom data loader for PDF files.