[Tickets #15056] Wrong MIME type on address book exports

noreply at bugs.horde.org noreply at bugs.horde.org
Mon May 3 20:00:50 UTC 2021


BITTE NICHT AUF DIESE NACHRICHT ANTWORTEN. NACHRICHTEN AN DIESE  
E-MAIL-ADRESSE WERDEN NICHT GELESEN.

Ticket-URL: https://bugs.horde.org/ticket/15056
------------------------------------------------------------------------------
  Ticket           | 15056
  Erstellt Von     | wahnes at uni-koeln.de
  Zusammenfassung  | Wrong MIME type on address book exports
  Warteschlange    | Turba
  Version          | FRAMEWORK_5_2
  Typ              | Bug
  Status           | Unconfirmed
  Priorität        | 2. Medium
  Milestone        |
  Patch            | 1
  Zuständige       |
------------------------------------------------------------------------------


wahnes at uni-koeln.de (2021-03-25 00:10) hat geschrieben:

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.



wahnes at uni-koeln.de (2021-03-25 00:10) hat hochgeladen:  
turba-mime-typ-vcard-export.patch

https://bugs.horde.org/h/services/download/?app=whups&actionID=download_file&file=turba-mime-typ-vcard-export.patch&ticket=15056&fn=%2Fturba-mime-typ-vcard-export.patch





More information about the bugs mailing list