diff options
Diffstat (limited to 'app/models/label.rb')
-rw-r--r-- | app/models/label.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/label.rb b/app/models/label.rb index 60c0fff44ce..9b8239d8757 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -52,11 +52,14 @@ class Label < ActiveRecord::Base # This pattern supports cross-project references. # def self.reference_pattern + # NOTE: The id pattern only matches when all characters on the expression + # are digits, so it will match ~2 but not ~2fa because that's probably a + # label name and we want it to be matched as such. @reference_pattern ||= %r{ (#{Project.reference_pattern})? #{Regexp.escape(reference_prefix)} (?: - (?<label_id>\d+) | # Integer-based label ID, or + (?<label_id>\d+(?!\S\w)\b) | # Integer-based label ID, or (?<label_name> [A-Za-z0-9_\-\?&]+ | # String-based single-word label title, or "([^"]*)" # String-based multi-word label surrounded in quotes |