@@ -32,7 +32,7 @@ use matrix_sdk::{
32
32
} ,
33
33
} ;
34
34
use matrix_sdk_ui:: timeline:: {
35
- self , EventItemOrigin , Profile , RepliedToEvent , TimelineDetails ,
35
+ self , AttachmentSource , EventItemOrigin , Profile , RepliedToEvent , TimelineDetails ,
36
36
TimelineUniqueId as SdkTimelineUniqueId ,
37
37
} ;
38
38
use mime:: Mime ;
@@ -130,8 +130,12 @@ impl Timeline {
130
130
. reply ( params. reply_params . map ( |p| p. try_into ( ) ) . transpose ( ) ?) ;
131
131
132
132
let handle = SendAttachmentJoinHandle :: new ( get_runtime_handle ( ) . spawn ( async move {
133
- let mut request =
134
- self . inner . send_attachment ( params. filename , mime_type, attachment_config) ;
133
+ let source = if let Some ( bytes) = params. file_data {
134
+ AttachmentSource :: Data { bytes, filename : params. filename }
135
+ } else {
136
+ AttachmentSource :: File ( params. filename . into ( ) )
137
+ } ;
138
+ let mut request = self . inner . send_attachment ( source, mime_type, attachment_config) ;
135
139
136
140
if params. use_send_queue {
137
141
request = request. use_send_queue ( ) ;
@@ -203,6 +207,8 @@ fn build_thumbnail_info(
203
207
pub struct UploadParameters {
204
208
/// Filename (previously called "url") for the media to be sent.
205
209
filename : String ,
210
+ /// Optional file data - if not present, then data is read from `filename`
211
+ file_data : Option < Vec < u8 > > ,
206
212
/// Optional non-formatted caption, for clients that support it.
207
213
caption : Option < String > ,
208
214
/// Optional HTML-formatted caption, for clients that support it.
0 commit comments