Skip to content

Commit 2e0d7d3

Browse files
committed
misc(ffi): Add filename to the FFI bindings too
1 parent e33c40e commit 2e0d7d3

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

bindings/matrix-sdk-ffi/src/client.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,10 +1006,11 @@ impl Client {
10061006
&self,
10071007
mime_type: String,
10081008
data: Vec<u8>,
1009+
filename: Option<String>,
10091010
progress_watcher: Option<Box<dyn ProgressWatcher>>,
10101011
) -> Result<String, ClientError> {
10111012
let mime_type: mime::Mime = mime_type.parse().context("Parsing mime type")?;
1012-
let request = self.inner.media().upload(&mime_type, data, None);
1013+
let request = self.inner.media().upload(&mime_type, data, filename, None);
10131014

10141015
if let Some(progress_watcher) = progress_watcher {
10151016
let mut subscriber = request.subscribe_to_send_progress();

bindings/matrix-sdk-ffi/src/timeline/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,11 @@ pub enum UploadSource {
219219
/// Upload source is a file on disk
220220
File {
221221
/// Path to file
222-
filename: String,
222+
path: String,
223+
224+
/// An optional filename, if the one in the path is not the one we want
225+
/// to use for the file.
226+
filename: Option<String>,
223227
},
224228
/// Upload source is data in memory
225229
Data {
@@ -233,7 +237,7 @@ pub enum UploadSource {
233237
impl From<UploadSource> for AttachmentSource {
234238
fn from(value: UploadSource) -> Self {
235239
match value {
236-
UploadSource::File { filename } => Self::File(filename.into()),
240+
UploadSource::File { path, filename } => Self::File { path: path.into(), filename },
237241
UploadSource::Data { bytes, filename } => Self::Data { bytes, filename },
238242
}
239243
}

0 commit comments

Comments
 (0)