diff --git a/src/sql/ob_sql_utils.cpp b/src/sql/ob_sql_utils.cpp index 1baca4f7e..2fb1004eb 100644 --- a/src/sql/ob_sql_utils.cpp +++ b/src/sql/ob_sql_utils.cpp @@ -4814,8 +4814,7 @@ int ObSQLUtils::check_location_access_priv(const ObString &location, ObSQLSessio ObArenaAllocator allocator; ObString real_location = location; real_location += strlen(OB_FILE_PREFIX); - if (!real_location.empty() && '.' == real_location[0]) { - //Relative path + if (!real_location.empty()) { ObArrayWrap buffer; OZ (buffer.allocate_array(allocator, PATH_MAX)); if (OB_SUCC(ret)) { @@ -5124,4 +5123,4 @@ int ObSQLUtils::print_identifier_require_quotes(ObCollationType collation_type, require = true; } return ret; -} \ No newline at end of file +} diff --git a/src/sql/resolver/ddl/ob_create_directory_resolver.cpp b/src/sql/resolver/ddl/ob_create_directory_resolver.cpp index 9cf150768..cda416367 100644 --- a/src/sql/resolver/ddl/ob_create_directory_resolver.cpp +++ b/src/sql/resolver/ddl/ob_create_directory_resolver.cpp @@ -98,16 +98,15 @@ int ObCreateDirectoryResolver::resolve(const ParseNode &parse_tree) } else { ObString real_directory_path; directory_path.assign_ptr(child_node->str_value_, static_cast(child_node->str_len_)); - directory_path.trim(); - if (!directory_path.empty() && '.' == directory_path[0]) { - //Relative path + if (!directory_path.empty()) { ObArrayWrap buffer; OZ (buffer.allocate_array(*allocator_, PATH_MAX)); if (OB_SUCC(ret)) { real_directory_path = ObString(realpath(to_cstring(directory_path), buffer.get_data())); + if (real_directory_path.empty()) { + real_directory_path = directory_path; + } } - } else { - real_directory_path = directory_path; } OZ (session_info_->get_secure_file_priv(secure_file_priv)); OZ (ObResolverUtils::check_secure_path(secure_file_priv, real_directory_path));