Hi,
I'm looking into downloading files using CAP. I'm using a custom handler to download the files (files get fetched from a C4C system using OData). The file download is working except for the fact that the filename is not set and I have to rename the file manually to be able to open it.
Example URL: /ServiceRequestAttachmentFolder('00163E10B4641ED89BF79ACCC3D13BD4')/Binary
This results in following download:
If I rename this file to e.g. test.pdf, I'm able to open the file.
Any ideas on how to set the actual filename? (e.g. attribute on result set, custom header, ...)
Thanks in advance!
Best regards,
Geert-Jan Klaps
UPDATE:
Solved this with following code for now (not the most ideal way since we're manipulating the headers manually, this is something the framework should be able to handle I guess):
req._.odataRes.setHeader('Content-Disposition',`attachment; filename="${result.Name}"`);