Skip to content

Commit

Permalink
fix(encoder): added valid extension to filename mime header otherwise…
Browse files Browse the repository at this point in the history
… the call to Audio.Transcriptions.New fails when passing io.Reader to AudioTranscriptionNewParams.File
  • Loading branch information
rezmoth committed Oct 23, 2024
1 parent 8d58dfa commit ebbb222
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/apiform/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func escapeQuotes(s string) string {
func (e *encoder) newReaderTypeEncoder() encoderFunc {
return func(key string, value reflect.Value, writer *multipart.Writer) error {
reader := value.Convert(reflect.TypeOf((*io.Reader)(nil)).Elem()).Interface().(io.Reader)
filename := "anonymous_file"
filename := "anonymous_file.mp3"
contentType := "application/octet-stream"
if named, ok := reader.(interface{ Name() string }); ok {
filename = path.Base(named.Name())
Expand Down

0 comments on commit ebbb222

Please sign in to comment.