Skip to content

Commit aff6ad8

Browse files
fix: multipart encoding for file arrays
1 parent d185f3d commit aff6ad8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/orb/internal/util.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ def encode_query_params(query)
610610
#
611611
# @return [Array(String, Enumerable<String>)]
612612
private def encode_multipart_streaming(body)
613+
# rubocop:disable Style/CaseEquality
613614
# RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length
614615
boundary = SecureRandom.urlsafe_base64(46)
615616

@@ -619,7 +620,7 @@ def encode_query_params(query)
619620
in Hash
620621
body.each do |key, val|
621622
case val
622-
in Array if val.all? { primitive?(_1) }
623+
in Array if val.all? { primitive?(_1) || Orb::Internal::Type::FileInput === _1 }
623624
val.each do |v|
624625
write_multipart_chunk(y, boundary: boundary, key: key, val: v, closing: closing)
625626
end
@@ -635,6 +636,7 @@ def encode_query_params(query)
635636

636637
fused_io = fused_enum(strio) { closing.each(&:call) }
637638
[boundary, fused_io]
639+
# rubocop:enable Style/CaseEquality
638640
end
639641

640642
# @api private

0 commit comments

Comments
 (0)