debugExtractNameFromMimeHeaders( $raw_headers ); assert_true( $parsed_name === 'VIDOK_Instrukcja Montażu I Uruchomienia - Wyroby Elektryczne.pdf', 'Expected parser to keep full unquoted file name with spaces and prefer it over technical att_* name.' ); $raw_headers_with_description = "Content-Type: application/octet-stream\r\n" . "Content-Disposition: attachment; filename=att_6995b8ad9d4567\r\n" . "Content-Description: VIDOK_Instrukcja Montażu I Uruchomienia - Wyroby Elektryczne.pdf\r\n"; $parsed_name_from_description = $importer -> debugExtractNameFromMimeHeaders( $raw_headers_with_description ); assert_true( $parsed_name_from_description === 'VIDOK_Instrukcja Montażu I Uruchomienia - Wyroby Elektryczne.pdf', 'Expected parser to use Content-Description when filename is only technical att_*.' ); $normalized_octet_pdf = MailToTaskImporter::normalizeImportedAttachmentName( '', 'application/octet-stream', "%PDF-1.6\n..." ); assert_true( $normalized_octet_pdf === 'zalacznik.pdf', 'Expected unnamed octet-stream with PDF signature to get pdf extension.' ); }