bool ignore_dir = FALSE;
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
char repl_path[MAX_PATH_LEN] = {0, };
+ media_svc_storage_type_e storage_type = MEDIA_SVC_STORAGE_MAX;
media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
memset(repl_path, 0, sizeof(repl_path));
media_content_retvm_if(ignore_dir == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
} else {
/* This means this folder has to be deleted */
+ /* Or, it is real invalid path.. check storage type */
+ ret = media_svc_get_storage_type(repl_path, &storage_type, tzplatform_getuid(TZ_USER_NAME));
+ if (ret != MS_MEDIA_ERR_NONE) {
+ media_content_sec_error("media_svc_get_storage_type failed : %d (%s)", ret, repl_path);
+ return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+ }
+
media_content_debug("This path doesn't exists in file system... So will be deleted it from DB");
}
+ ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, tzplatform_getuid(TZ_USER_NAME));
+ if (ret != MS_MEDIA_ERR_NONE) {
+ media_content_error("media_svc_get_storage_id failed : %d", ret);
+ return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+ }
+
media_content_scan_cb_data *cb_data = NULL;
cb_data = (media_content_scan_cb_data *)malloc(sizeof(media_content_scan_cb_data));
media_content_retvm_if(cb_data == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
cb_data->callback = callback;
cb_data->user_data = user_data;
- ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, tzplatform_getuid(TZ_USER_NAME));
- if (ret != MS_MEDIA_ERR_NONE) {
- media_content_error("media_svc_get_storage_id failed : %d", ret);
- return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
- }
-
ret = media_directory_scanning_async(repl_path, storage_id, is_recursive, _media_content_scan_cb, cb_data, tzplatform_getuid(TZ_USER_NAME));
- if (ret != MS_MEDIA_ERR_NONE)
+ if (ret != MS_MEDIA_ERR_NONE) {
media_content_error("media_directory_scanning_async failed : %d", ret);
+ SAFE_FREE(cb_data);
+ }
return _content_error_capi(MEDIA_REGISTER_TYPE, ret);
}