Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit b6f0f40

Browse files
committed
client: Fix Client::update on empty registry storage
1 parent 1cbd8d5 commit b6f0f40

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

crates/client/src/storage/fs.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ impl RegistryStorage for FileSystemRegistryStorage {
9797
let mut packages = Vec::new();
9898

9999
let packages_dir = self.base_dir.join(PACKAGE_LOGS_DIR);
100+
if !packages_dir.exists() {
101+
return Ok(vec![]);
102+
}
103+
100104
for entry in WalkDir::new(&packages_dir) {
101105
let entry = entry.with_context(|| {
102106
anyhow!(

tests/client.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ async fn client_incrementally_fetches() -> Result<()> {
8080
// Recreate the client with the same config
8181
let client = create_client(&config)?;
8282

83+
// Regression test: update on empty registry storage
84+
client.update().await?;
85+
8386
// Fetch the package log
8487
client.upsert([&id]).await?;
8588

0 commit comments

Comments
 (0)