From: Andrzej Popowski Date: Tue, 27 Jan 2015 08:39:59 +0000 (+0100) Subject: [Messaging] Fixing the problem with the prefix file:// in attachments X-Git-Tag: submit/tizen_tv/20150603.064601~1^2~557 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f756a4accaf0fbaca36d18cc7d9fb77be6627f33;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Messaging] Fixing the problem with the prefix file:// in attachments Change-Id: I3520a686c3db93b43af3b554474f80dce3313668 Signed-off-by: Andrzej Popowski --- diff --git a/src/messaging/message_attachment.cc b/src/messaging/message_attachment.cc index d529af09..d5e261a7 100755 --- a/src/messaging/message_attachment.cc +++ b/src/messaging/message_attachment.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include #include "message_attachment.h" #include "common/logger.h" @@ -124,7 +125,16 @@ std::string MessageAttachment::getShortFileName() const void MessageAttachment::setFilePath(const std::string &value) { - m_filePath = value; + std::string tmp = value; + // change to lower case + for (int i = 0; i < tmp.length() && i < 4; i++) { + tmp[i] = tolower(tmp[i]); + } + if (tmp.find("file://") != std::string::npos) { + m_filePath = value.substr(7); + } else { + m_filePath = value; + } m_isFilePathSet = true; } diff --git a/src/messaging/messaging_api.js b/src/messaging/messaging_api.js index 8243ea9b..d4bfbfca 100644 --- a/src/messaging/messaging_api.js +++ b/src/messaging/messaging_api.js @@ -6,6 +6,7 @@ var validator_ = xwalk.utils.validator; var types_ = validator_.Types; +var T_ = xwalk.utils.type; var bridge = xwalk.utils.NativeBridge(extension, true); function throwException_(err) { @@ -453,7 +454,8 @@ function Message(type, data) { if (value.length < _internal.length) { _internal.splice(value.length, _internal.length - value.length); } - } else { + _internal.attachments = value; + } else if (T_.isArray(value)) { for (var k = 0; k < value.length; ++k) { if (!(value[k] instanceof tizen.MessageAttachment)) { return; @@ -920,10 +922,6 @@ MessageService.prototype.stopSync = function () { {name: 'opId', type: types_.LONG} ]); - if(arguments.opId === undefined){ - throw new tizen.WebAPIException(tizen.WebAPIException.TYPE_MISMATCH_ERR); - } - var self = this; bridge.sync({ cmd: 'MessageService_stopSync',