| 105 | } |
| 106 | |
| 107 | Result<Path> DiskCacheImpl::resolveAbsolutePath(const Path& path, bool isRead) const { |
| 108 | auto newPath = !path.isAbsolute() ? _rootPath.appending(path) : path; |
| 109 | newPath.normalize(); |
| 110 | |
| 111 | const auto& pathToCheck = isRead ? _allowedReadPath : _rootPath; |
| 112 | |
| 113 | if (!newPath.startsWith(pathToCheck)) { |
| 114 | return Error(STRING_FORMAT( |
| 115 | "Resolved path '{}' is outside of allowed path '{}'", newPath.toString(), pathToCheck.toString())); |
| 116 | } |
| 117 | |
| 118 | return newPath; |
| 119 | } |
| 120 | |
| 121 | std::vector<Path> DiskCacheImpl::list(const Path& path) const { |
| 122 | return DiskUtils::listDirectory(path); |
nothing calls this directly
no test coverage detected