MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / is_valid_subpath

Function is_valid_subpath

common/hf-cache.cpp:166–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166static bool is_valid_subpath(const fs::path & path, const fs::path & subpath) {
167 if (subpath.is_absolute()) {
168 return false; // never do a / b with b absolute
169 }
170 auto b = fs::absolute(path).lexically_normal();
171 auto t = (b / subpath).lexically_normal();
172 auto [b_end, _] = std::mismatch(b.begin(), b.end(), t.begin(), t.end());
173
174 return b_end == b.end();
175}
176
177static void safe_write_file(const fs::path & path, const std::string & data) {
178 fs::path path_tmp = path.string() + ".tmp";

Callers 2

get_repo_commitFunction · 0.85
get_repo_filesFunction · 0.85

Calls 2

endMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected