Fix empty images
This commit is contained in:
+3
-2
@@ -4,7 +4,7 @@ use megalodon::entities::UploadMedia;
|
||||
use megalodon::generator;
|
||||
use megalodon::megalodon::PostStatusInputOptions;
|
||||
use megalodon::{self, megalodon::UploadMediaInputOptions};
|
||||
use std::io::Cursor;
|
||||
use std::io::{Cursor, Seek, SeekFrom};
|
||||
|
||||
use crate::{StdError, APP_USER_AGENT};
|
||||
|
||||
@@ -25,7 +25,8 @@ pub async fn toot(text: &str, img: Option<Box<Cursor<Vec<u8>>>>) -> StdError<()>
|
||||
Some(APP_USER_AGENT.into()),
|
||||
);
|
||||
let mut ops = PostStatusInputOptions::default();
|
||||
if let Some(img) = img {
|
||||
if let Some(mut img) = img {
|
||||
img.as_mut().seek(SeekFrom::Start(0))?;
|
||||
let media = client
|
||||
.upload_media_reader(img, Some(&UploadMediaInputOptions::default()))
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user