@@ -43,7 +43,9 @@ def self.build_form_request(request_body)
4343 content_type = attachment [ :content_type ] || attachment [ "content_type" ]
4444 file . define_singleton_method ( :content_type ) { content_type } if content_type
4545
46- form_data . merge! ( { "file#{ index } " => file } )
46+ content_id = attachment [ :content_id ] || attachment [ "content_id" ] || "file#{ index } "
47+
48+ form_data . merge! ( { content_id => file } )
4749 opened_files << file
4850 end
4951
@@ -100,7 +102,7 @@ def self.handle_message_payload(request_body)
100102 # @param file_path [String] The path to the file to attach.
101103 # @param filename [String] The name of the attached file. Optional, derived from file_path by default.
102104 # @return [Hash] The request that will attach the file to the message/draft
103- def self . attach_file_request_builder ( file_path , filename = nil )
105+ def self . attach_file_request_builder ( file_path , filename = nil , content_id = nil )
104106 filename ||= File . basename ( file_path )
105107 content_type = MIME ::Types . type_for ( file_path )
106108 content_type = if !content_type . nil? && !content_type . empty?
@@ -110,12 +112,12 @@ def self.attach_file_request_builder(file_path, filename = nil)
110112 end
111113 size = File . size ( file_path )
112114 content = File . new ( file_path , "rb" )
113-
114115 {
115116 filename : filename ,
116117 content_type : content_type ,
117118 size : size ,
118119 content : content ,
120+ content_id : content_id ,
119121 file_path : file_path
120122 }
121123 end
0 commit comments