Skip to content

Commit 9e8d6bc

Browse files
authored
[Turbopack] avoid crashing on e.g. .DS_Store (#75050)
### What? Accept unexpected files in the persistent cache data directory
1 parent 645ef16 commit 9e8d6bc

File tree

1 file changed

+12
-2
lines changed
  • turbopack/crates/turbo-persistence/src

1 file changed

+12
-2
lines changed

turbopack/crates/turbo-persistence/src/db.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,12 @@ impl TurboPersistence {
273273
// ignore blobs, they are read when needed
274274
}
275275
_ => {
276-
bail!("Unexpected file in persistence directory: {:?}", path);
276+
if !path
277+
.file_name()
278+
.is_some_and(|s| s.as_encoded_bytes().starts_with(b"."))
279+
{
280+
bail!("Unexpected file in persistence directory: {:?}", path);
281+
}
277282
}
278283
}
279284
}
@@ -283,7 +288,12 @@ impl TurboPersistence {
283288
// Already read
284289
}
285290
_ => {
286-
bail!("Unexpected file in persistence directory: {:?}", path);
291+
if !path
292+
.file_name()
293+
.is_some_and(|s| s.as_encoded_bytes().starts_with(b"."))
294+
{
295+
bail!("Unexpected file in persistence directory: {:?}", path);
296+
}
287297
}
288298
}
289299
}

0 commit comments

Comments
 (0)