mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
Fix GC failures on bad store path names
It failed on names like '/nix/store/9ip48nkc9rfy0a4yaw98lp6gipqlib1a-'.
This commit is contained in:
parent
2e953b567e
commit
22a754c091
4 changed files with 35 additions and 29 deletions
|
@ -55,6 +55,20 @@ StorePath Store::parseStorePath(std::string_view path) const
|
|||
return StorePath::make(path, storeDir);
|
||||
}
|
||||
|
||||
std::optional<StorePath> Store::maybeParseStorePath(std::string_view path) const
|
||||
{
|
||||
try {
|
||||
return parseStorePath(path);
|
||||
} catch (Error &) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
bool Store::isStorePath(const Path & path) const
|
||||
{
|
||||
return (bool) maybeParseStorePath(path);
|
||||
}
|
||||
|
||||
StorePathSet Store::parseStorePathSet(const PathSet & paths) const
|
||||
{
|
||||
StorePathSet res;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue