mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-23 02:00:49 +00:00
table function file - fix path validate [#add_table_function_file]
This commit is contained in:
parent
0a9e281199
commit
2100d00764
@ -46,16 +46,13 @@ namespace DB
|
|||||||
std::string structure = static_cast<const ASTLiteral &>(*args[2]).value.safeGet<String>();
|
std::string structure = static_cast<const ASTLiteral &>(*args[2]).value.safeGet<String>();
|
||||||
|
|
||||||
/// Validate path
|
/// Validate path
|
||||||
Poco::Path clickhouse_data_poco_path = Poco::Path(context.getPath() + "/data").makeAbsolute();
|
Poco::Path clickhouse_data_poco_path = Poco::Path(context.getPath() + "data").makeAbsolute();
|
||||||
throw Exception(context.getPath() + "/data");
|
|
||||||
std::string clickhouse_data_path = clickhouse_data_poco_path.toString();
|
std::string clickhouse_data_path = clickhouse_data_poco_path.toString();
|
||||||
|
|
||||||
Poco::Path poco_path = Poco::Path(path);
|
Poco::Path poco_path = Poco::Path(path);
|
||||||
if (poco_path.isRelative())
|
if (poco_path.isRelative())
|
||||||
{
|
|
||||||
poco_path = Poco::Path(clickhouse_data_poco_path, poco_path);
|
poco_path = Poco::Path(clickhouse_data_poco_path, poco_path);
|
||||||
|
|
||||||
}
|
|
||||||
std::string absolute_path = poco_path.absolute().toString();
|
std::string absolute_path = poco_path.absolute().toString();
|
||||||
|
|
||||||
if (!startsWith(absolute_path, clickhouse_data_path))
|
if (!startsWith(absolute_path, clickhouse_data_path))
|
||||||
|
Loading…
Reference in New Issue
Block a user