mirror of
https://github.com/openai/codex.git
synced 2026-05-25 05:24:37 +00:00
Use v2 OpenAI file download resolver
This commit is contained in:
@@ -159,7 +159,7 @@ pub async fn get_openai_file_download_info(
|
||||
file_id: &str,
|
||||
) -> Result<OpenAiFileDownloadInfo, OpenAiFileError> {
|
||||
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!({
|
||||
|
||||
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user