diff options
author | Clement Ho <ClemMakesApps@gmail.com> | 2018-03-13 13:09:37 -0500 |
---|---|---|
committer | Clement Ho <ClemMakesApps@gmail.com> | 2018-03-13 13:09:37 -0500 |
commit | 736b4ecf8efa034d95923e8741fb0e31b0d15bfe (patch) | |
tree | 96ed63e408c2ac24cc704a6b5a48b3497ed01f16 /app/helpers/import_helper.rb | |
parent | 2e5de941392c8463a5e15e9f8cb3a3ab147b656d (diff) | |
parent | 8f73ddd896dad7bd66d9c96dafcc4311ce272447 (diff) | |
download | gitlab-ce-add-csslab.tar.gz |
Merge branch 'master' into add-csslabadd-csslab
Diffstat (limited to 'app/helpers/import_helper.rb')
-rw-r--r-- | app/helpers/import_helper.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/app/helpers/import_helper.rb b/app/helpers/import_helper.rb index 9149d79ecb8..4664b1728c4 100644 --- a/app/helpers/import_helper.rb +++ b/app/helpers/import_helper.rb @@ -1,4 +1,6 @@ module ImportHelper + include ::Gitlab::Utils::StrongMemoize + def has_ci_cd_only_params? false end @@ -75,17 +77,18 @@ module ImportHelper private def github_project_url(full_path) - "#{github_root_url}/#{full_path}" + URI.join(github_root_url, full_path).to_s end def github_root_url - return @github_url if defined?(@github_url) + strong_memoize(:github_url) do + provider = Gitlab::Auth::OAuth::Provider.config_for('github') - provider = Gitlab.config.omniauth.providers.find { |p| p.name == 'github' } - @github_url = provider.fetch('url', 'https://github.com') if provider + provider&.dig('url').presence || 'https://github.com' + end end def gitea_project_url(full_path) - "#{@gitea_host_url.sub(%r{/+\z}, '')}/#{full_path}" + URI.join(@gitea_host_url, full_path).to_s end end |