[DF180510-00418] Allow file name with a leading dot 99/179999/3
authorSeonah Moon <seonah1.moon@samsung.com>
Thu, 24 May 2018 04:41:12 +0000 (13:41 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Thu, 24 May 2018 05:15:11 +0000 (14:15 +0900)
Change-Id: I9e28be26ed4125a53f5ed8336314527cf7b7a11a

agent/download-agent-file.c
packaging/download-provider.spec

index db37376..b44c3a6 100755 (executable)
@@ -90,27 +90,22 @@ da_ret_t __divide_file_name_into_pure_name_N_extesion(const char *in_file_name,
        file_name = (char *)in_file_name;
 
        tmp_ptr = strrchr(file_name, '.');
-       if (tmp_ptr)
-               tmp_ptr++;
-       if (tmp_ptr && out_extension) {
-               strncpy((char*) tmp_ext, tmp_ptr, sizeof(tmp_ext) - 1);
-               *out_extension = strdup((const char*) tmp_ext);
-               DA_SECURE_LOGD("extension [%s]", *out_extension);
-       } else if (!tmp_ptr && url) {
-               char *extension = DA_NULL;
-               da_bool_t b_ret = da_get_extension_name_from_url(url, &extension);
-               if (b_ret && !extension) {
-#if 0
-                       tmp_ptr = strrchr(file_name, '.');
-                       if (tmp_ptr)
-                               tmp_ptr++;
-                       if (tmp_ptr && out_extension) {
-                               strncpy((char*) tmp_ext, tmp_ptr, sizeof(tmp_ext) - 1);
-                               *out_extension = strdup((const char*) tmp_ext);
-                               DA_SECURE_LOGD("extension [%s]", *out_extension);
-                       }
-#endif
-                       *out_extension = NULL;
+
+       if (tmp_ptr == file_name) {
+               // a leading dot means the file is hidden.
+               tmp_ptr = DA_NULL;
+       } else {
+               if (tmp_ptr)
+                       tmp_ptr++;
+               if (tmp_ptr && out_extension) {
+                       strncpy((char*) tmp_ext, tmp_ptr, sizeof(tmp_ext) - 1);
+                       *out_extension = strdup((const char*) tmp_ext);
+                       DA_SECURE_LOGD("extension [%s]", *out_extension);
+               } else if (!tmp_ptr && url) {
+                       char *extension = DA_NULL;
+                       da_bool_t b_ret = da_get_extension_name_from_url(url, &extension);
+                       if (b_ret && !extension)
+                               *out_extension = NULL;
                }
        }
 
index 2e44a0d..51cdbe0 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       download-provider
 Summary:    Download the contents in background
-Version:    2.1.96
+Version:    2.1.97
 Release:    0
 Group:      Development/Libraries
 License:    Apache-2.0