mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-02 04:48:18 +00:00
Make uv cache prune robust to unreadable rkyv entries (#7561)
## Summary We're robust to these in the rest of the CLI, but not in `uv cache prune`.
This commit is contained in:
parent
b8f9ee3b4d
commit
f9b882939f
1 changed files with 2 additions and 4 deletions
|
|
@ -1806,8 +1806,7 @@ pub fn prune(cache: &Cache) -> Result<Removal, Error> {
|
|||
// directories.
|
||||
let revision = entry.path().join("revision.http");
|
||||
if revision.is_file() {
|
||||
let pointer = HttpRevisionPointer::read_from(revision)?;
|
||||
if let Some(pointer) = pointer {
|
||||
if let Ok(Some(pointer)) = HttpRevisionPointer::read_from(revision) {
|
||||
// Remove all sibling directories that are not referenced by the pointer.
|
||||
for sibling in entry.path().read_dir().map_err(Error::CacheRead)? {
|
||||
let sibling = sibling.map_err(Error::CacheRead)?;
|
||||
|
|
@ -1832,8 +1831,7 @@ pub fn prune(cache: &Cache) -> Result<Removal, Error> {
|
|||
// directories.
|
||||
let revision = entry.path().join("revision.rev");
|
||||
if revision.is_file() {
|
||||
let pointer = LocalRevisionPointer::read_from(revision)?;
|
||||
if let Some(pointer) = pointer {
|
||||
if let Ok(Some(pointer)) = LocalRevisionPointer::read_from(revision) {
|
||||
// Remove all sibling directories that are not referenced by the pointer.
|
||||
for sibling in entry.path().read_dir().map_err(Error::CacheRead)? {
|
||||
let sibling = sibling.map_err(Error::CacheRead)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue