aboutsummaryrefslogtreecommitdiff
path: root/src/api/icons.rs
diff options
context:
space:
mode:
authorMathijs van Veluw <[email protected]>2024-12-05 22:10:59 +0100
committerGitHub <[email protected]>2024-12-05 22:10:59 +0100
commit71b3d3c818db846bb1972ed79188b3709b9f822b (patch)
tree113b1d215799d55763d699ba8e548d6aa64c7b2c /src/api/icons.rs
parentda3701c0cfa5fb0fe505c18c5f210edb2a71aaf9 (diff)
downloadvaultwarden-71b3d3c818db846bb1972ed79188b3709b9f822b.tar.gz
vaultwarden-71b3d3c818db846bb1972ed79188b3709b9f822b.zip
Update Rust and crates (#5248)
* Update Rust and crates - Updated Rust to v1.83.0 - Updated MSRV to v1.82.0 (Needed for html5gum crate) - Updated icon fetching code to match new html5gum version - Updated workflows - Enabled edition 2024 clippy lints Nightly reports some clippy hints, but that would be too much to change in this PR i think. Signed-off-by: BlackDex <[email protected]> * Some additional updates - Patch fern to allow syslog-7 feature - Fixed diesel logger which was broken because of the sqlite backup feature Refactored the sqlite backup because of this - Added a build workflow test to include the query_logger feature Signed-off-by: BlackDex <[email protected]> * Also patch yubico-rs and latest updates Signed-off-by: BlackDex <[email protected]> --------- Signed-off-by: BlackDex <[email protected]>
Diffstat (limited to 'src/api/icons.rs')
-rw-r--r--src/api/icons.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/api/icons.rs b/src/api/icons.rs
index ebcace6d..921d48b9 100644
--- a/src/api/icons.rs
+++ b/src/api/icons.rs
@@ -19,7 +19,7 @@ use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
};
-use html5gum::{Emitter, HtmlString, InfallibleTokenizer, Readable, StringReader, Tokenizer};
+use html5gum::{Emitter, HtmlString, Readable, StringReader, Tokenizer};
use crate::{
error::Error,
@@ -261,11 +261,7 @@ impl Icon {
}
}
-fn get_favicons_node(
- dom: InfallibleTokenizer<StringReader<'_>, FaviconEmitter>,
- icons: &mut Vec<Icon>,
- url: &url::Url,
-) {
+fn get_favicons_node(dom: Tokenizer<StringReader<'_>, FaviconEmitter>, icons: &mut Vec<Icon>, url: &url::Url) {
const TAG_LINK: &[u8] = b"link";
const TAG_BASE: &[u8] = b"base";
const TAG_HEAD: &[u8] = b"head";
@@ -274,7 +270,7 @@ fn get_favicons_node(
let mut base_url = url.clone();
let mut icon_tags: Vec<Tag> = Vec::new();
- for token in dom {
+ for Ok(token) in dom {
let tag_name: &[u8] = &token.tag.name;
match tag_name {
TAG_LINK => {
@@ -401,7 +397,7 @@ async fn get_icon_url(domain: &str) -> Result<IconUrlResult, Error> {
// 384KB should be more than enough for the HTML, though as we only really need the HTML header.
let limited_reader = stream_to_bytes_limit(content, 384 * 1024).await?.to_vec();
- let dom = Tokenizer::new_with_emitter(limited_reader.to_reader(), FaviconEmitter::default()).infallible();
+ let dom = Tokenizer::new_with_emitter(limited_reader.to_reader(), FaviconEmitter::default());
get_favicons_node(dom, &mut iconlist, &url);
} else {
// Add the default favicon.ico to the list with just the given domain