Filename in content-disposition should have extension
Overview
When I download the pdf of a mail merge contact activity, the filename in content-disposition
is without extension.
Reproduction steps
- Edit a contact and go to activities
- Click 'edit' on a Mail merge activity
- Click preview or download.
Current behaviour
This is the header of response:
content-type: application/pdf
content-disposition: attachment; filename="filename_without_extension"
Expected behaviour
content-type: application/pdf
content-disposition: attachment; filename="filename_without_extension.pdf"
Environment information
- CiviCRM: 5.45.1
- PHP: 7.4
- CMS: Wordpress 5.8.3
- Database: MySQL 8
Comments
I think that at row 266 of CRM/Contact/Form/Task/PDFTrait.php
we have to add extension to filename:
if ($type === 'pdf') {
CRM_Utils_PDF_Utils::html2pdf($html, $fileName . '.pdf', FALSE, $formValues);
}
current:
if ($type === 'pdf') {
CRM_Utils_PDF_Utils::html2pdf($html, $fileName, FALSE, $formValues);
}