Search code examples
phpjoomlamime-typesvcf-vcardyoothemes

Joomla Zoo download element wrong content-type or mime-type for vcard (.vcf)


My client is using Joomla 3.7.2 and they are using the Zoo component by YOOTheme. They have created an App I believe it's called in jargon and they've added a property (element) where you can download a file.

The App is an article type app and they've used the default download element. I added the permissions to upload certain files and I've uploaded a VCF file (a vCard file).

The problem occurs when I download that file. Joomla seems to add the Content-Type: 'text/x-vcalendar'. This should be 'text/x-vcard'. I have no idea where to change this.

I have added this mime-type to my .htaccess, so when I directly link to the file, apache does send the right content type header. Therefor I know that the problem lies in either joomla or a PHP function that returns the wrong mime type.

Where do I change the mime-type for these files?


Solution

  • I finally found it. There's a function in the file: /administrator/components/com_zoo/framework/helpers/filesystem.php

    Within this file there's a function called getMimeMapping. In it is an array with all the file extensions and mime types used per extension:

    $mimes['vcf'][] = 'text/x-vcalendar';
    $mimes['vcs'][] = 'text/x-vcalendar';
    $mimes['vct'][] = 'text/x-vcard';
    

    So apparently if I use the extension vct, it will output the correct Content-Type.