diff --git a/codex-rs/codex-api/src/files.rs b/codex-rs/codex-api/src/files.rs index a03cde8370..323f7f7866 100644 --- a/codex-rs/codex-api/src/files.rs +++ b/codex-rs/codex-api/src/files.rs @@ -159,7 +159,7 @@ pub async fn get_openai_file_download_info( file_id: &str, ) -> Result { let base_url = base_url.trim_end_matches('/'); - let download_link_url = format!("{base_url}/files/{file_id}/download"); + let download_link_url = format!("{base_url}/files/download/{file_id}"); let response = authorized_request(auth, reqwest::Method::GET, &download_link_url) .send() .await @@ -803,7 +803,7 @@ mod tests { async fn get_openai_file_download_info_defaults_missing_status_to_success() { let server = MockServer::start().await; Mock::given(method("GET")) - .and(path("/backend-api/files/file_123/download")) + .and(path("/backend-api/files/download/file_123")) .and(header("authorization", "Bearer token")) .and(header("chatgpt-account-id", "account_id")) .respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({ diff --git a/codex-rs/core/src/codex_apps_file_download.rs b/codex-rs/core/src/codex_apps_file_download.rs index bc6c949027..9220f59494 100644 --- a/codex-rs/core/src/codex_apps_file_download.rs +++ b/codex-rs/core/src/codex_apps_file_download.rs @@ -322,7 +322,7 @@ mod tests { let attacker_hits = Arc::new(std::sync::atomic::AtomicUsize::new(0)); let attacker_hits_responder = Arc::clone(&attacker_hits); Mock::given(method("GET")) - .and(path("/backend-api/files/file_123/download")) + .and(path("/backend-api/files/download/file_123")) .and(header("authorization", "Bearer Access Token")) .and(header("chatgpt-account-id", "account_id")) .respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({ @@ -431,7 +431,7 @@ mod tests { let attacker_server = MockServer::start().await; Mock::given(method("GET")) - .and(path("/backend-api/files/file_123/download")) + .and(path("/backend-api/files/download/file_123")) .and(header("authorization", "Bearer Access Token")) .and(header("chatgpt-account-id", "account_id")) .respond_with(ResponseTemplate::new(500).set_body_string("boom"))