Closed Bug 919853 Opened 11 years ago Closed 11 years ago

Unable to get corresponding extension from nsIMIMEService::GetPrimaryExtension

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: echou, Assigned: echou)

References

Details

Attachments

(1 file)

In order to be capable of sharing contacts via Bluetooth while no SD card installed, Gecko Bluetooth has to deal with a 'blob' but not a 'file'. The main difference is: blob doesn't have 'name' property. However, most mobile devices would turn down the file sharing request once the file name is empty or the extension is missing.

Currently Gecko Bluetooth uses function nsIMIMEService::GetPrimaryExtension(), trying to get the primary extension from mime type. Take sharing contacts as an example, the mime type "text/vcard" is sent to function GetPrimaryExtension() as the first argument, but the out parameter won't get any value.

I have traced related parts of code, found that there is a table in nsExternalHelperAppService.cpp for mapping extension and mimetype. We should add text/vcard and .vcf mapping record in that table.
This patch does:

1. Add an record of vCard mapping in table extraMimeEntries
2. Replace deprecated mime type definition "text/x-vcard" with "text/vcard"

So that we can get corresponding extension (.vcf) from vCard blobs which have mime type "text/vcard".

Hi bz,

I saw you leaving comments in bug 891334 about the extraMimeEntries change. My patch also changes that table. Could you assist with reviewing my patch?

Hi francisco,

According to RFC 6350, "text/x-vcard" should have been deprecated in favor of "text/vcard". That's why I modified the definition of TEXT_VCARD in nsMimeTypes.h. Please assist with reviewing my patch.
Assignee: nobody → echou
Attachment #808978 - Flags: review?(francisco.jordano)
Attachment #808978 - Flags: review?(bzbarsky)
Comment on attachment 808978 [details] [diff] [review]
patch 1: v1: Add mimetype and extension mapping of vCard

r=me
Attachment #808978 - Flags: review?(bzbarsky) → review+
Comment on attachment 808978 [details] [diff] [review]
patch 1: v1: Add mimetype and extension mapping of vCard

Looking good to me, we will change the references in the frontend to use the correct mimetype.

Thanks!
Attachment #808978 - Flags: review?(francisco.jordano) → review+
https://hg.mozilla.org/mozilla-central/rev/b16fd01c41f6
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Blocks: 917645
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: