Class LinkRedactor

java.lang.Object
org.nuxeo.common.utils.LinkRedactor

public final class LinkRedactor extends Object
Utility class for redacting linkable content from plain text before rendering in contexts where auto-linking may occur (such as email clients).

Email clients like Gmail, Outlook and Apple Mail automatically convert plain-text URLs and email addresses into clickable links. This class provides methods to redact such patterns from user-provided text to prevent content spoofing.

Since:
2025.18
  • Field Details

  • Method Details

    • redactLinks

      public static String redactLinks(String text)
      Redacts URLs and email addresses from the given plain text.

      URLs are replaced with "[link removed]" and email addresses with "[email removed]". This prevents email clients from auto-linking user-provided content, which could be used for phishing.

      Parameters:
      text - the text to sanitize, may be null
      Returns:
      the sanitized text with URLs and emails redacted, or null if input was null