diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-07-12 21:33:25 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-07-13 11:42:31 -0300 |
commit | f682c0975b3a589d9fc6dae585cf6e36fa9ac348 (patch) | |
tree | f0fa9bcc907e0a8ceac0eeca8e244c9568e9aab9 /app/models/label.rb | |
parent | c88075f46772d3c462969372fafbd7f3886872b8 (diff) | |
download | gitlab-ce-f682c0975b3a589d9fc6dae585cf6e36fa9ac348.tar.gz |
Fix markdown rendering for label references that begin with a digit
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 |