diff options
-rw-r--r-- | src/libstore/local-binary-cache-store.cc | 14 | ||||
-rw-r--r-- | src/libstore/s3-binary-cache-store.cc | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/libstore/local-binary-cache-store.cc b/src/libstore/local-binary-cache-store.cc index b6e72b039..2c2944938 100644 --- a/src/libstore/local-binary-cache-store.cc +++ b/src/libstore/local-binary-cache-store.cc @@ -33,6 +33,20 @@ protected: std::shared_ptr<std::string> getFile(const std::string & path) override; + PathSet queryAllValidPaths() override + { + PathSet paths; + + for (auto & entry : readDirectory(binaryCacheDir)) { + if (entry.name.size() != 40 || + !hasSuffix(entry.name, ".narinfo")) + continue; + paths.insert(settings.nixStore + "/" + entry.name.substr(0, entry.name.size() - 8)); + } + + return paths; + } + }; void LocalBinaryCacheStore::init() diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc index 58ee0b638..cffcb1bf2 100644 --- a/src/libstore/s3-binary-cache-store.cc +++ b/src/libstore/s3-binary-cache-store.cc @@ -227,8 +227,8 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore for (auto object : contents) { auto & key = object.GetKey(); - if (!hasSuffix(key, ".narinfo")) continue; - paths.insert(settings.nixStore + "/" + std::string(key, 0, key.size() - 8)); + if (key.size() != 40 || !hasSuffix(key, ".narinfo")) continue; + paths.insert(settings.nixStore + "/" + key.substr(0, key.size() - 8)); } marker = res.GetNextMarker(); |