Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not error if the CACHEDIR.TAG file exists but cannot be written to #7550

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion crates/uv-fs/src/cachedir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ pub fn add_tag<P: AsRef<path::Path>>(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<P: AsRef<path::Path>>(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,
Expand Down
Loading