File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
lib/supabase/fetcher/adapter Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -124,10 +124,20 @@ defmodule Supabase.Fetcher.Adapter.Finch do
124124
125125 @ impl true
126126 def upload ( % Request { } = b , file , opts \\ [ ] ) do
127- mime_type = MIME . from_path ( file )
128127 body_stream = File . stream! ( file , 2048 )
129128 % File.Stat { size: content_length } = File . stat! ( file )
130- content_headers = [ { "content-length" , to_string ( content_length ) } , { "content-type" , mime_type } ]
129+
130+ # Only use MIME.from_path if content-type is not already set
131+ content_type =
132+ case Supabase.Fetcher.Request . get_header ( b , "content-type" ) do
133+ nil -> MIME . from_path ( file )
134+ existing -> existing
135+ end
136+
137+ content_headers = [
138+ { "content-length" , to_string ( content_length ) } ,
139+ { "content-type" , content_type }
140+ ]
131141
132142 b
133143 |> with_body ( { :stream , body_stream } )
You can’t perform that action at this time.
0 commit comments