From: Kyeonghun Lee Date: Thu, 6 Oct 2016 07:05:22 +0000 (+0900) Subject: [TSAM-8409] add code to get mime type by extension when unknown mimetype is decoded... X-Git-Tag: submit/tizen/20161011.042615~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=283cbcf71fc4e73973dd888a5aeca8c337114f7c;p=platform%2Fcore%2Fmessaging%2Fmsg-service.git [TSAM-8409] add code to get mime type by extension when unknown mimetype is decoded from mms Change-Id: I5fd738876da025cc7e42a9ce282af78d25f39599 Signed-off-by: Kyeonghun Lee --- diff --git a/plugin/mms_plugin/MmsPluginDecode.cpp b/plugin/mms_plugin/MmsPluginDecode.cpp index 0bf2923..13e972a 100755 --- a/plugin/mms_plugin/MmsPluginDecode.cpp +++ b/plugin/mms_plugin/MmsPluginDecode.cpp @@ -2335,6 +2335,21 @@ static bool __MmsBinaryDecodeEachPart(FILE *pFile, char *szFilePath, MsgType *pM default: MSG_DEBUG("Normal Part"); + if (pMsgType->type == MIME_UNKNOWN) { + char szFileName[MSG_FILENAME_LEN_MAX+1] = {0}; + MimeType mimeType = MIME_UNKNOWN; + + if (pMsgType->param.szName[0] != '\0') + snprintf(szFileName, MSG_FILENAME_LEN_MAX, "%s", pMsgType->param.szName); + else if (pMsgType->param.szFileName[0] != '\0') + snprintf(szFileName, MSG_FILENAME_LEN_MAX, "%s", pMsgType->param.szFileName); + else if (pMsgType->szContentLocation[0] != '\0') + snprintf(szFileName, MSG_FILENAME_LEN_MAX, "%s", pMsgType->szContentLocation); + + MsgGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, szFileName, &mimeType, NULL); + pMsgType->type = mimeType; + } + bSuccess = __MmsBinaryDecodePartBody(pFile, bodyLength, totalLength); if (bSuccess == false) { MSG_DEBUG("Decode contentBody Fail");