From c46007893ceb836a6759e7ac494940a21e11e77c Mon Sep 17 00:00:00 2001 From: deedy5 <65482418+deedy5@users.noreply.github.com> Date: Tue, 15 Oct 2024 11:19:10 +0300 Subject: [PATCH] Bump html2text to v0.13 --- Cargo.lock | 19 ++++++++++--------- Cargo.toml | 2 +- src/response.rs | 8 ++++---- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d37e290..252a7cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -467,12 +467,13 @@ checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "html2text" -version = "0.12.6" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "042a9677c258ac2952dd026bb0cd21972f00f644a5a38f5a215cb22cdaf6834e" +checksum = "798d9204cbc4c44031b448b41330af1b4df95e4861ea1e89665ecef01d544f1a" dependencies = [ "html5ever", "markup5ever", + "nom", "tendril", "thiserror", "unicode-width", @@ -480,9 +481,9 @@ dependencies = [ [[package]] name = "html5ever" -version = "0.27.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4" +checksum = "2e15626aaf9c351bc696217cbe29cb9b5e86c43f8a46b5e2f5c6c5cf7cb904ce" dependencies = [ "log", "mac", @@ -648,9 +649,9 @@ checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" [[package]] name = "markup5ever" -version = "0.12.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45" +checksum = "82c88c6129bd24319e62a0359cb6b958fa7e8be6e19bb1663bc396b90883aca5" dependencies = [ "log", "phf", @@ -899,7 +900,7 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "primp" -version = "0.6.3" +version = "0.6.4" dependencies = [ "ahash", "anyhow", @@ -1624,9 +1625,9 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "unindent" diff --git a/Cargo.toml b/Cargo.toml index 412270b..049e13c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ encoding_rs = { version = "0.8" } ahash = "0.8" indexmap = { version = "2", features = ["serde"] } tokio = { version = "1", features = ["full"] } -html2text = "0.12" +html2text = "0.13" bytes = "1" [profile.release] diff --git a/src/response.rs b/src/response.rs index 5932978..32c4cb4 100644 --- a/src/response.rs +++ b/src/response.rs @@ -4,7 +4,7 @@ use anyhow::{anyhow, Result}; use encoding_rs::Encoding; use html2text::{ from_read, from_read_with_decorator, - render::text_renderer::{RichDecorator, TrivialDecorator}, + render::{RichDecorator, TrivialDecorator}, }; use indexmap::IndexMap; use pyo3::{prelude::*, types::PyBytes}; @@ -85,7 +85,7 @@ impl Response { #[getter] fn text_markdown(&mut self, py: Python) -> Result { let raw_bytes = self.content.bind(py).as_bytes(); - let text = py.allow_threads(|| from_read(raw_bytes, 100)); + let text = py.allow_threads(|| from_read(raw_bytes, 100))?; Ok(text) } @@ -93,7 +93,7 @@ impl Response { fn text_plain(&mut self, py: Python) -> Result { let raw_bytes = self.content.bind(py).as_bytes(); let text = - py.allow_threads(|| from_read_with_decorator(raw_bytes, 100, TrivialDecorator::new())); + py.allow_threads(|| from_read_with_decorator(raw_bytes, 100, TrivialDecorator::new()))?; Ok(text) } @@ -101,7 +101,7 @@ impl Response { fn text_rich(&mut self, py: Python) -> Result { let raw_bytes = self.content.bind(py).as_bytes(); let text = - py.allow_threads(|| from_read_with_decorator(raw_bytes, 100, RichDecorator::new())); + py.allow_threads(|| from_read_with_decorator(raw_bytes, 100, RichDecorator::new()))?; Ok(text) } }