diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-22 19:38:09 -0700 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-22 19:38:09 -0700 |
commit | b3c6f0b297773a946379a6fca8b3165cb66c6754 (patch) | |
tree | 3488f8138a1d0c8bc9087fffefd8542e691ea725 /lib | |
parent | d5bb86b0116a875f0d08ded04c2146c5fa8654a0 (diff) | |
parent | e9b00588364b01dd9020f90e56c8252e306f0a53 (diff) | |
download | gitlab-ce-b3c6f0b297773a946379a6fca8b3165cb66c6754.tar.gz |
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/bitbucket_import/client.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/github_import/client.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/gitlab_import/client.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/reference_extractor.rb | 8 |
4 files changed, 11 insertions, 5 deletions
diff --git a/lib/gitlab/bitbucket_import/client.rb b/lib/gitlab/bitbucket_import/client.rb index 1e4906c9e31..5b1952b9675 100644 --- a/lib/gitlab/bitbucket_import/client.rb +++ b/lib/gitlab/bitbucket_import/client.rb @@ -62,7 +62,7 @@ module Gitlab end def find_deploy_key(project_identifier, key) - JSON.parse(api.get("/api/1.0/repositories/#{project_identifier}/deploy-keys").body).find do |deploy_key| + JSON.parse(api.get("/api/1.0/repositories/#{project_identifier}/deploy-keys").body).find do |deploy_key| deploy_key["key"].chomp == key.chomp end end @@ -92,7 +92,7 @@ module Gitlab end def bitbucket_options - OmniAuth::Strategies::Bitbucket.default_options[:client_options].dup + OmniAuth::Strategies::Bitbucket.default_options[:client_options].symbolize_keys end end end diff --git a/lib/gitlab/github_import/client.rb b/lib/gitlab/github_import/client.rb index 7fe076b333b..270cbcd9ccd 100644 --- a/lib/gitlab/github_import/client.rb +++ b/lib/gitlab/github_import/client.rb @@ -46,7 +46,7 @@ module Gitlab end def github_options - OmniAuth::Strategies::GitHub.default_options[:client_options].dup + OmniAuth::Strategies::GitHub.default_options[:client_options].symbolize_keys end end end diff --git a/lib/gitlab/gitlab_import/client.rb b/lib/gitlab/gitlab_import/client.rb index 2236439c6ce..f48ede9d067 100644 --- a/lib/gitlab/gitlab_import/client.rb +++ b/lib/gitlab/gitlab_import/client.rb @@ -71,7 +71,7 @@ module Gitlab end def gitlab_options - OmniAuth::Strategies::GitLab.default_options[:client_options].dup + OmniAuth::Strategies::GitLab.default_options[:client_options].symbolize_keys end end end diff --git a/lib/gitlab/reference_extractor.rb b/lib/gitlab/reference_extractor.rb index 5b9772de168..1058d4c43d9 100644 --- a/lib/gitlab/reference_extractor.rb +++ b/lib/gitlab/reference_extractor.rb @@ -11,7 +11,13 @@ module Gitlab end def analyze(string, project) - parse_references(string.dup, project) + text = string.dup + + # Remove preformatted/code blocks so that references are not included + text.gsub!(%r{<pre>.*?</pre>|<code>.*?</code>}m) { |match| '' } + text.gsub!(%r{^```.*?^```}m) { |match| '' } + + parse_references(text, project) end # Given a valid project, resolve the extracted identifiers of the requested type to |