table function file - fix path validate [#add_table_function_file]

This commit is contained in:
decaseal 2018-04-02 18:49:40 +03:00
parent 0a9e281199
commit 2100d00764

View File

@ -46,16 +46,13 @@ namespace DB
std::string structure = static_cast<const ASTLiteral &>(*args[2]).value.safeGet<String>();
/// Validate path
Poco::Path clickhouse_data_poco_path = Poco::Path(context.getPath() + "/data").makeAbsolute();
throw Exception(context.getPath() + "/data");
Poco::Path clickhouse_data_poco_path = Poco::Path(context.getPath() + "data").makeAbsolute();
std::string clickhouse_data_path = clickhouse_data_poco_path.toString();
Poco::Path poco_path = Poco::Path(path);
if (poco_path.isRelative())
{
poco_path = Poco::Path(clickhouse_data_poco_path, poco_path);
}
std::string absolute_path = poco_path.absolute().toString();
if (!startsWith(absolute_path, clickhouse_data_path))