Use v2 OpenAI file download resolver

This commit is contained in:
Liang-Ting Jiang
2026-04-25 10:45:00 -07:00
parent 5371d8f1fc
commit c436c8563b
2 changed files with 4 additions and 4 deletions

View File

@@ -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!({

View File

@@ -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"))