diff --git a/crates/uv-fs/src/cachedir.rs b/crates/uv-fs/src/cachedir.rs index e19625d89111..cb2feb390f32 100644 --- a/crates/uv-fs/src/cachedir.rs +++ b/crates/uv-fs/src/cachedir.rs @@ -32,9 +32,13 @@ pub fn add_tag>(directory: P) -> io::Result<()> { /// Will return an error if The tag file doesn't exist and can't be created for any reason /// (the `directory` doesn't exist, permission error, can't write to the file etc.). pub fn ensure_tag>(directory: P) -> io::Result<()> { - match add_tag(directory) { + match add_tag(&directory) { Err(e) => match e.kind() { io::ErrorKind::AlreadyExists => Ok(()), + // If it exists, but we can't write to it for some reason don't fail + io::ErrorKind::PermissionDenied if directory.as_ref().join("CACHEDIR.TAG").exists() => { + Ok(()) + } _ => Err(e), }, other => other,