fix the issue that returns image file name not path 06/132206/1 accepted/tizen/unified/20170605.151059 submit/tizen/20170602.090116
authorJongkyu Koo <jk.koo@samsung.com>
Thu, 1 Jun 2017 12:50:35 +0000 (21:50 +0900)
committerJongkyu Koo <jk.koo@samsung.com>
Thu, 1 Jun 2017 12:50:35 +0000 (21:50 +0900)
Change-Id: Iab191545c7f76e08ef16c73604600723e1fb471b
Signed-off-by: Jongkyu Koo <jk.koo@samsung.com>
server/db/ctsvc_db_plugin_image.c
server/db/ctsvc_db_query.c

index 5ae1579..c9f3c40 100644 (file)
@@ -29,6 +29,7 @@
 #include "ctsvc_db_query.h"
 #include "ctsvc_list.h"
 #include "ctsvc_notification.h"
+#include "ctsvc_notify.h"
 
 
 static int __ctsvc_db_image_get_default_image_id(int contact_id)
@@ -735,8 +736,12 @@ static int __ctsvc_db_image_get_records_with_query(contacts_query_h query, int o
                                break;
                        case CTSVC_PROPERTY_IMAGE_PATH:
                                temp = ctsvc_stmt_get_text(stmt, i);
-                               free(image->path);
-                               image->path = SAFE_STRDUP(temp);
+                               if (temp) {
+                                       char full_path[CTSVC_IMG_FULL_PATH_SIZE_MAX] = {0};
+                                       snprintf(full_path, sizeof(full_path), "%s/%s", CTSVC_CONTACT_IMG_FULL_LOCATION, temp);
+                                       free(image->path);
+                                       image->path = strdup(full_path);
+                               }
                                break;
                        case CTSVC_PROPERTY_IMAGE_IS_DEFAULT:
                                image->is_default = ctsvc_stmt_get_int(stmt, i);
index b7a38a2..60d6806 100644 (file)
@@ -2445,7 +2445,7 @@ static int __ctsvc_db_search_records_exec(const char *view_uri,
        char *query = NULL;
        char temp_query[CTS_SQL_MAX_LEN];
        int query_size;
-       int temp_len;
+       int temp_len = 0;
        const char *table;
        int len = 0;
        int ret;