From 9d94e79a2b774506a5acf6de0246402732a3fe9b Mon Sep 17 00:00:00 2001 From: Ben Govero Date: Fri, 20 Feb 2026 15:15:10 -0600 Subject: [PATCH] fixed how array fields are sent in multipart form POSTs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s not necessary to url_encode the field keys, and that breaks timestamp_granularities[], among other things --- lib/openai/internal/util.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/openai/internal/util.rb b/lib/openai/internal/util.rb index 429fbaf7..9f1e6d10 100644 --- a/lib/openai/internal/util.rb +++ b/lib/openai/internal/util.rb @@ -540,8 +540,7 @@ class << self y << "Content-Disposition: form-data" unless key.nil? - name = ERB::Util.url_encode(key.to_s) - y << "; name=\"#{name}\"" + y << "; name=\"#{key}\"" end case val @@ -577,7 +576,7 @@ class << self case val in Array if val.all? { primitive?(_1) } val.each do |v| - write_multipart_chunk(y, boundary: boundary, key: key, val: v, closing: closing) + write_multipart_chunk(y, boundary: boundary, key: "#{key}[]", val: v, closing: closing) end else write_multipart_chunk(y, boundary: boundary, key: key, val: val, closing: closing)