class Dependabot::PullRequestCreator::MessageBuilder::LinkAndMentionSanitizer
def sanitize_links(doc)
def sanitize_links(doc) doc.walk do |node| if node.type == :link && node.url.match?(GITHUB_REF_REGEX) node.each do |subnode| unless subnode.type == :text && subnode.string_content.match?(GITHUB_REF_REGEX) next end last_match = T.must(subnode.string_content.match(GITHUB_REF_REGEX)) number = last_match.named_captures.fetch("number") repo = last_match.named_captures.fetch("repo") subnode.string_content = "#{repo}##{number}" end node.url = replace_github_host(node.url) elsif node.type == :text && node.string_content.match?(GITHUB_REF_REGEX) node.string_content = replace_github_host(node.string_content) end end end