From 08ffce7572af048290a7e10defbc83efc98fb54e Mon Sep 17 00:00:00 2001 From: easonysliu Date: Sun, 15 Mar 2026 10:01:22 +0800 Subject: [PATCH] fix(token_storage): propagate errors when creating/securing token dir\n\nCloses #493\n\nPreviously, failures to create the token directory or set its permissions were silently ignored with `let _`. This could lead to confusing errors later when writing the token file or result in insecure permissions. This change propagates these errors up to the caller. --- src/token_storage.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/token_storage.rs b/src/token_storage.rs index aa1726c7..0171daf6 100644 --- a/src/token_storage.rs +++ b/src/token_storage.rs @@ -74,11 +74,11 @@ impl EncryptedTokenStorage { let encrypted = crate::credential_store::encrypt(json.as_bytes())?; if let Some(parent) = self.file_path.parent() { - let _ = tokio::fs::create_dir_all(parent).await; + tokio::fs::create_dir_all(parent).await?; #[cfg(unix)] { use std::os::unix::fs::PermissionsExt; - let _ = std::fs::set_permissions(parent, std::fs::Permissions::from_mode(0o700)); + std::fs::set_permissions(parent, std::fs::Permissions::from_mode(0o700))?; } }