diff --git a/server/src/lib.rs b/server/src/lib.rs index c184c91..9e84d05 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -121,11 +121,11 @@ impl Transformer for InlineStyle { struct AddOutlink(Option); impl Transformer for AddOutlink { - fn should_run(&self, _: &str) -> bool { - self.0 - .as_ref() - .map(|l| l.scheme().starts_with("http")) - .unwrap_or(false) + fn should_run(&self, html: &str) -> bool { + if let Some(link) = &self.0 { + return link.scheme().starts_with("http") && !html.contains(link.as_str()); + } + false } fn transform(&self, html: &str) -> Result { if let Some(url) = &self.0 {