Checks that a path specified as parameters of Disk() is valid.
| 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) |
no test coverage detected