From f682c0975b3a589d9fc6dae585cf6e36fa9ac348 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Tue, 12 Jul 2016 21:33:25 -0300 Subject: Fix markdown rendering for label references that begin with a digit --- app/models/label.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/models/label.rb') 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)} (?: - (?\d+) | # Integer-based label ID, or + (?\d+(?!\S\w)\b) | # Integer-based label ID, or (? [A-Za-z0-9_\-\?&]+ | # String-based single-word label title, or "([^"]*)" # String-based multi-word label surrounded in quotes -- cgit v1.2.1