From: Pawel Kaczmarczyk Date: Thu, 18 Jan 2018 11:34:57 +0000 (+0100) Subject: [Messaging] Synchronously checking access to file X-Git-Tag: submit/tizen/20180427.125243~9^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e9ceb0aced20946202dae6545a319f53a4c7065;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Messaging] Synchronously checking access to file ACR: http://suprem.sec.samsung.net/jira/browse/TWDAPI-187 [Verification] Tested in Chromium console Passrate with storage privileges: tct-messaging-email-tizen-tests: 100% tct-messaging-sms-tizen-tests: 100% tct-messaging-mms-tizen-tests: 100% Change-Id: Iacf8b3c647d65e20fc73a810746ff1a536f7507d Signed-off-by: Pawel Kaczmarczyk --- diff --git a/src/messaging/messaging_instance.cc b/src/messaging/messaging_instance.cc index 2cf41a50..91578660 100644 --- a/src/messaging/messaging_instance.cc +++ b/src/messaging/messaging_instance.cc @@ -20,6 +20,7 @@ #include #include +#include "common/filesystem/filesystem_provider.h" #include "common/logger.h" #include "common/tools.h" @@ -203,6 +204,18 @@ void MessagingInstance::MessageServiceSendMessage(const picojson::value& args, picojson::object data = args.get(); picojson::value v_message = data.at(SEND_MESSAGE_ARGS_MESSAGE); + + bool has_attachments = v_message.get("hasAttachment").get(); + if (has_attachments) { + const auto& attachments = v_message.get("attachments").get>(); + for (const auto& att : attachments) { + const auto& attachment_path = att.get("filePath").get(); + const auto& attachment_real_path = + common::FilesystemProvider::Create().GetRealPath(attachment_path); + CHECK_STORAGE_ACCESS(attachment_real_path, &out); + } + } + const double callbackId = args.get(JSON_CALLBACK_ID).get(); auto json = std::shared_ptr(new picojson::value(picojson::object()));