mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-06-17 20:58:27 -04:00
misc(ffi): Add filename to the FFI bindings too
This commit is contained in:
@@ -1026,10 +1026,11 @@ impl Client {
|
||||
&self,
|
||||
mime_type: String,
|
||||
data: Vec<u8>,
|
||||
filename: Option<String>,
|
||||
progress_watcher: Option<Box<dyn ProgressWatcher>>,
|
||||
) -> Result<String, ClientError> {
|
||||
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();
|
||||
|
||||
@@ -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<String>,
|
||||
},
|
||||
/// Upload source is data in memory
|
||||
Data {
|
||||
@@ -233,7 +237,7 @@ pub enum UploadSource {
|
||||
impl From<UploadSource> 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 },
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user