diff --git a/bindings/matrix-sdk-ffi/src/client.rs b/bindings/matrix-sdk-ffi/src/client.rs index c602deb95..2f832a88d 100644 --- a/bindings/matrix-sdk-ffi/src/client.rs +++ b/bindings/matrix-sdk-ffi/src/client.rs @@ -1026,10 +1026,11 @@ impl Client { &self, mime_type: String, data: Vec, + filename: Option, progress_watcher: Option>, ) -> Result { let mime_type: mime::Mime = mime_type.parse().context("Parsing mime type")?; - let request = self.inner.media().upload(&mime_type, data, None); + let request = self.inner.media().upload(&mime_type, data, filename, None); if let Some(progress_watcher) = progress_watcher { let mut subscriber = request.subscribe_to_send_progress(); diff --git a/bindings/matrix-sdk-ffi/src/timeline/mod.rs b/bindings/matrix-sdk-ffi/src/timeline/mod.rs index 641560f89..79d3a8200 100644 --- a/bindings/matrix-sdk-ffi/src/timeline/mod.rs +++ b/bindings/matrix-sdk-ffi/src/timeline/mod.rs @@ -219,7 +219,11 @@ pub enum UploadSource { /// Upload source is a file on disk File { /// Path to file - filename: String, + path: String, + + /// An optional filename, if the one in the path is not the one we want + /// to use for the file. + filename: Option, }, /// Upload source is data in memory Data { @@ -233,7 +237,7 @@ pub enum UploadSource { impl From for AttachmentSource { fn from(value: UploadSource) -> Self { match value { - UploadSource::File { filename } => Self::File(filename.into()), + UploadSource::File { path, filename } => Self::File { path: path.into(), filename }, UploadSource::Data { bytes, filename } => Self::Data { bytes, filename }, } }