summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
index cea00a9d5e..ca9182469a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
@@ -511,7 +511,8 @@ void SystemRequest::Run() {
return;
}
- if (!file_system::IsFileNameValid(file_name)) {
+ if (!file_system::IsFileNameValid(file_name) &&
+ mobile_apis::RequestType::ICON_URL != request_type) {
const std::string err_msg = "Sync file name contains forbidden symbols.";
LOG4CXX_ERROR(logger_, err_msg);
SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str());
@@ -533,8 +534,22 @@ void SystemRequest::Run() {
std::string binary_data_folder;
if ((*message_)[strings::params].keyExists(strings::binary_data)) {
binary_data = (*message_)[strings::params][strings::binary_data].asBinary();
- binary_data_folder =
- application_manager_.get_settings().system_files_path();
+ if (mobile_apis::RequestType::ICON_URL == request_type) {
+ binary_data_folder =
+ application_manager_.get_settings().app_icons_folder();
+ // Use the URL file name to identify the policy id.
+ // Save the icon file with the policy id as the name.
+ file_name = application_manager_.PolicyIDByIconUrl(file_name);
+ if (file_name.empty()) {
+ const std::string err_msg = "Invalid file name";
+ SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str());
+ return;
+ }
+ LOG4CXX_DEBUG(logger_, "Got ICON_URL Request. File name: " << file_name);
+ } else {
+ binary_data_folder =
+ application_manager_.get_settings().system_files_path();
+ }
} else {
binary_data_folder =
application_manager_.get_settings().app_storage_folder();
@@ -581,6 +596,12 @@ void SystemRequest::Run() {
LOG4CXX_DEBUG(logger_, "Binary data ok.");
+ if (mobile_apis::RequestType::ICON_URL == request_type) {
+ application_manager_.SetIconFileFromSystemRequest(file_name);
+ SendResponse(true, mobile_apis::Result::SUCCESS);
+ return;
+ }
+
if (mobile_apis::RequestType::HTTP == request_type &&
(*message_)[strings::msg_params].keyExists(strings::file_name)) {
const std::string& file =