fix(rust): handle bad tok_1

This commit is contained in:
Móricz Gergő 2025-01-25 12:53:00 +01:00
parent e8a6c1bb65
commit 4a1ab6f01c

View File

@ -263,7 +263,7 @@ fn _transform_html_inner(opts: TranformHTMLOptions) -> Result<String, ()> {
for img in document.select("img[srcset]")? {
let mut sizes: Vec<ImageSource> = img.attributes.borrow().get("srcset").ok_or(())?.to_string().split(",").filter_map(|x| {
let tok: Vec<&str> = x.trim().split(" ").collect();
let tok_1 = if tok.len() > 1 {
let tok_1 = if tok.len() > 1 && tok[1].len() > 0 {
tok[1]
} else {
"1x"