Skip to content

Commit

Permalink
fix: file size
Browse files Browse the repository at this point in the history
  • Loading branch information
pk5ls20 committed Feb 19, 2025
1 parent 25ff9d9 commit a561215
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mania/src/message/entity/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ impl ImageEntity {
}
}

pub(crate) async fn resolve_stream(&self) -> Option<AsyncStream> {
pub(crate) async fn resolve_stream(&mut self) -> Option<AsyncStream> {
if let Some(file_path) = &self.file_path {
let file = tokio::fs::File::open(file_path).await.ok()?;
let size = file.metadata().await.ok()?.len() as u32;
self.size = size;
Some(Arc::new(tokio::sync::Mutex::new(
Box::new(file) as AsyncPureStream
)))
Expand Down

0 comments on commit a561215

Please sign in to comment.