From a89a25714dc07ace7dc1762f87faad5c9470f620 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 23 Oct 2023 14:19:38 +0200 Subject: [PATCH] Fix some link anchors being recognized as hashtags (#27271) --- app/models/tag.rb | 2 +- spec/models/tag_spec.rb | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/models/tag.rb b/app/models/tag.rb index 47a05d00a..8dbcf6f31 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -33,7 +33,7 @@ class Tag < ApplicationRecord HASTAG_LAST_SEQUENCE = '([[:word:]_]*[[:alpha:]][[:word:]_]*)' HASHTAG_NAME_PAT = "#{HASHTAG_FIRST_SEQUENCE}|#{HASTAG_LAST_SEQUENCE}" - HASHTAG_RE = /(?:^|[^\/\)\w])#(#{HASHTAG_NAME_PAT})/i + HASHTAG_RE = %r{(?