if (sticker_data->thumbnail && strcmp(sticker_data->thumbnail, origin_data->thumbnail) != 0) {
LOGD("origin_thumbnail : %s, new_thumbnail : %s", origin_data->thumbnail, sticker_data->thumbnail);
- ret = _send_sync_message(gdbus_connection, g_variant_new("(is)", sticker_data->sticker_info_id, sticker_data->thumbnail), &reply, "update_sticker_thumbnail");
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(iss)", sticker_data->sticker_info_id, sticker_data->app_id, sticker_data->thumbnail), &reply, "update_sticker_thumbnail");
if (ret != STICKER_CLIENT_ERROR_NONE) {
LOGE("failed to update sticker thumbnail");
goto cleanup;
" <method name='update_sticker_thumbnail'>"
" <arg type='i' name='record_id' direction='in'/>"
+ " <arg type='s' name='app_id' direction='in'/>"
" <arg type='s' name='thumbnail' direction='in'/>"
" </method>"
}
}
+ if (sticker_info->thumbnail) {
+ if (_check_file_exist(sticker_info->app_id, sticker_info->thumbnail) == 0) {
+ sticker_info->thumbnail = _convert_sticker_uri(sticker_info->thumbnail, sticker_info->app_id);
+ if (!sticker_info->thumbnail) {
+ LOGE("failed to copy sticker thumbnail");
+ ret = STICKERD_SERVER_ERROR_FILE_EXISTS;
+ goto cleanup;
+ }
+ } else {
+ LOGE("sticker thumbnail does not exist");
+ ret = STICKERD_SERVER_ERROR_NO_SUCH_FILE;
+ goto cleanup;
+ }
+ }
+
ret = stickerd_db_insert_sticker_info(&record_id, sticker_info);
if (ret != STICKERD_SERVER_ERROR_NONE) {
LOGE("Failed to insert sticker info");
goto free_memory;
sticker_info->thumbnail = _get_string_from_object(info_object, "thumbnail");
- if (!sticker_info->thumbnail)
- goto free_memory;
+ if (sticker_info->thumbnail) {
+ if (_check_file_exist(sticker_info->app_id, sticker_info->thumbnail) == 0) {
+ sticker_info->thumbnail = _convert_sticker_uri(sticker_info->thumbnail, sticker_info->app_id);
+ if (!sticker_info->thumbnail)
+ goto free_memory;
+ } else {
+ goto free_memory;
+ }
+ }
sticker_info->description = _get_string_from_object(info_object, "description");
{
int ret;
int record_id;
+ char *app_id;
char *thumbnail;
*reply_body = g_variant_new("()");
return STICKERD_SERVER_ERROR_OPERATION_FAILED;
}
- g_variant_get(parameters, "(i&s)", &record_id, &thumbnail);
+ g_variant_get(parameters, "(i&s&s)", &record_id, &app_id, &thumbnail);
+
+ if (_check_file_exist(app_id, thumbnail) == 0) {
+ thumbnail = _convert_sticker_uri(thumbnail, app_id);
+ if (!thumbnail) {
+ LOGE("failed to copy sticker thumbnail");
+ return STICKERD_SERVER_ERROR_FILE_EXISTS;
+ }
+ } else {
+ return STICKERD_SERVER_ERROR_NO_SUCH_FILE;
+ }
ret = stickerd_db_update_sticker_info(record_id, STICKER_DB_STICKER_THUMBNAIL, (void *)thumbnail);
if (ret != STICKERD_SERVER_ERROR_NONE) {