MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / checkPath

Function checkPath

src/Backups/registerBackupEnginesFileAndDisk.cpp:55–65  ·  view source on GitHub ↗

Checks that a path specified as parameters of Disk() is valid.

Source from the content-addressed store, hash-verified

53
54 /// Checks that a path specified as parameters of Disk() is valid.
55 void checkPath(const String & disk_name, const DiskPtr & disk, fs::path & path)
56 {
57 path = path.lexically_normal();
58 if (!path.is_relative() && (disk->getDataSourceDescription().type == DataSourceType::Local))
59 path = path.lexically_proximate(disk->getPath());
60
61 bool path_ok = path.empty() || (path.is_relative() && (*path.begin() != ".."));
62 if (!path_ok)
63 throw Exception(ErrorCodes::BAD_ARGUMENTS, "Path '{}' to backup must be inside the specified disk '{}'",
64 quoteString(path.c_str()), quoteString(disk_name));
65 }
66
67 /// Checks that a path specified as parameters of File() is valid.
68 void checkPath(fs::path & path, const Poco::Util::AbstractConfiguration & config, const fs::path & data_dir)

Callers 1

Calls 9

ExceptionClass · 0.50
quoteStringFunction · 0.50
to_stringFunction · 0.50
getPathMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
hasMethod · 0.45
getStringMethod · 0.45

Tested by

no test coverage detected