Skip to content

Commit

Permalink
fix(build): fix html img src
Browse files Browse the repository at this point in the history
  • Loading branch information
fiji-flo committed Jan 16, 2025
1 parent 4e96b7a commit b5af77e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/rari-doc/src/html/fix_img.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ pub fn handle_img(
base: &Url,
base_url: &ParseOptions,
) -> HandlerResult {
// Leave dimensions alone if we have a `width` attribute
if el.get_attribute("width").is_some() {
return Ok(());
}
if let Some(src) = el.get_attribute("src") {
let url = base_url.parse(&src)?;
if url.host() == base.host() && !url.path().starts_with("/assets/") {
el.set_attribute("src", url.path())?;
// Leave dimensions alone if we have a `width` attribute
if el.get_attribute("width").is_some() {
return Ok(());
}
let mut file = page.full_path().parent().unwrap().join(&src);
if !file.try_exists().unwrap_or_default() {
if let Ok(en_us_page) =
Expand Down

0 comments on commit b5af77e

Please sign in to comment.