Skip to content

Commit 77b017f

Browse files
authored
fix: truncate auth.json file before rewriting it (openai#1231)
This was missed in openai#1212. Caught by @rizwankce in openai#1174 (reply in thread).
1 parent c02d25f commit 77b017f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

codex-rs/login/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub async fn try_read_openai_api_key(codex_home: &Path) -> std::io::Result<Strin
7575
auth_dot_json.last_refresh = Utc::now();
7676

7777
let mut options = OpenOptions::new();
78-
options.write(true).create(true);
78+
options.truncate(true).write(true).create(true);
7979
#[cfg(unix)]
8080
{
8181
options.mode(0o600);

0 commit comments

Comments
 (0)