diff options
author | Vinnie Okada <vokada@mrvinn.com> | 2014-10-01 22:45:26 +0400 |
---|---|---|
committer | Vinnie Okada <vokada@mrvinn.com> | 2014-10-03 21:30:20 +0400 |
commit | 7edc1439fe11e396bb6327a3f50aca5dfe3c411c (patch) | |
tree | 2222fc6f1919581a8208bd5f1b5c8b63397d2993 /lib/gitlab | |
parent | 1b1ba6b0a51cda30df2fe68fa577f6045d187b86 (diff) |
Fix ReferenceExtractor
The cross-project reference feature broke the ReferenceExtractor class;
this fixes it.
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/markdown.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/reference_extractor.rb | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb index 8380193deb3..51c33f7cb1d 100644 --- a/lib/gitlab/markdown.rb +++ b/lib/gitlab/markdown.rb @@ -146,13 +146,15 @@ module Gitlab end # Called from #parse_references. Attempts to build a gitlab reference - # link. Returns nil if either +type+ or +project+ are nil, if the match - # string is an HTML entity, or if the reference is invalid. + # link. Returns nil if +type+ is nil, if the match string is an HTML + # entity, if the reference is invalid, or if the matched text includes an + # invalid project path. def parse_result(match_info, type, project, project_prefix) prefix = match_info[:prefix] suffix = match_info[:suffix] - return nil if html_entity?(prefix, suffix) || project.nil? || type.nil? + return nil if html_entity?(prefix, suffix) || type.nil? + return nil if project.nil? && !project_prefix.nil? identifier = match_info[type] ref_link = reference_link(type, identifier, project, project_prefix) diff --git a/lib/gitlab/reference_extractor.rb b/lib/gitlab/reference_extractor.rb index 73b19ad55d5..d2f02f712ce 100644 --- a/lib/gitlab/reference_extractor.rb +++ b/lib/gitlab/reference_extractor.rb @@ -51,7 +51,7 @@ module Gitlab private - def reference_link(type, identifier, project) + def reference_link(type, identifier, _, _) # Append identifier to the appropriate collection. send("#{type}s") << identifier end |