async fn upload_url_to_bucket(bucket: Box<Bucket>, url: &str, filename: &str) -> Result<s3::utils::PutStreamResponse, s3::error::S3Error>{
    let response = reqwest::get(url).await.expect("Failed to download image");
    let stream = response.bytes_stream().map_err(std::io::Error::other);
    let mut stream = tokio_util::io::StreamReader::new(stream);

    let result = bucket.put_object_stream(&mut stream, filename).await;
    result
}

Изменить пасту