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;
}
}