Skip to content

Commit

Permalink
simplify regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed Aug 4, 2024
1 parent bb60dd4 commit 8ad4354
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/html_pipeline/node_filter/mention_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def link_to_mentioned_user(base_url, login)
result[:mentioned_usernames] |= [login]

url = base_url.dup
excluded_prefixes = [%r{[/~]\z}, %r{[/@]\z}]
url << "/" unless excluded_prefixes.any? { |excluded_prefix| excluded_prefix.match?(url) }
excluded_prefixes = %r{[/(?:~|@]\z}
url << "/" unless excluded_prefixes.match?(url)

"<a href=\"#{url << login}\" class=\"user-mention\">" \
"@#{login}" \
Expand Down

0 comments on commit 8ad4354

Please sign in to comment.