6.0.0-alpha10
5/14/25

Search Results: 96 of 173 [ <<First <Prev Next> Last>> ] [ Return to Search Results ]


[#15056] Wrong MIME type on address book exports
Summary Wrong MIME type on address book exports
Queue Turba
Queue Version FRAMEWORK_5_2
Type Bug
State Unconfirmed
Priority 2. Medium
Owners
Requester wahnes (at) uni-koeln (dot) de
Created 03/25/2021 (1511 days ago)
Due
Updated 03/25/2021 (1511 days ago)
Assigned
Resolved
Milestone
Patch Yes

History
03/25/2021 12:10:51 AM wahnes (at) uni-koeln (dot) de Comment #1
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ Wrong MIME type on address book exports
Queue ⇒ Turba
Milestone ⇒
Patch ⇒ Yes
New Attachment: turba-mime-typ-vcard-export.patch Download
Reply to this comment
When employing Turba's Import/Export feature to export an address book 
using the vCard format (either version 2 or 3), the downloaded file's 
MIME type is wrong. The HTTP header will be

Content-Type: text/calendar

when it should be

Content-Type: text/vcard

While a wrong MIME type normally is not the most important thing on 
earth, it can have some undesired results. When this is combined with 
"no browser sniffing" headers (i.e. "X-Content-Type-Options: 
nosniff"), some browsers will not simply adopt the filename suggested 
by the "Content-Disposition" header's filename field, which would read 
"contacts.vcf" in this case. Instead, the browser will suggest saving 
the file as "contacts.ics" because it has been declared an iCalendar 
file (text/calendar). This in turn will be irritating for 
non-tech-savvy users, as a file with this name will not be 
automatically imported by a local contact management software.

The reason for the wrong MIME type seems to be that the 
"Horde_Data_Vcard" class inherits directly from "Horde_Data_Imc". The 
Horde_Data_Imc's "exportFile" method always uses the "text/calendar" 
MIME type when making files available for download.

I saw in the neighboring Horde_Data_Csv class that there is a field 
called "_contentType" which may allow not to duplicate 
Horde_Data_Imc's exportFile method for use with Horde_Data_Vcard, but 
merely adjust the MIME type when downloading. However, my practical 
knowledge of PHP's object model and is not sufficient to actually make 
use of non-duplicated code here. As a result, the attached patch is 
probably not the right way to do it, but it does solve the problem at 
hand.

Saved Queries