diff options
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/dependency_linker/base_linker.rb | 10 | ||||
-rw-r--r-- | lib/gitlab/middleware/unauthenticated_session_expiry.rb | 3 |
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/gitlab/dependency_linker/base_linker.rb b/lib/gitlab/dependency_linker/base_linker.rb index 74bec55253f..2c9b559c8dc 100644 --- a/lib/gitlab/dependency_linker/base_linker.rb +++ b/lib/gitlab/dependency_linker/base_linker.rb @@ -31,13 +31,15 @@ module Gitlab end def external_url(name, external_ref) - return if GIT_INVALID_URL_REGEX.match?(external_ref) + ref = external_ref.to_s - case external_ref + return if GIT_INVALID_URL_REGEX.match?(ref) + + case ref when /\A#{URL_REGEX}\z/o - external_ref + ref when /\A#{REPO_REGEX}\z/o - github_url(external_ref) + github_url(ref) else package_url(name) end diff --git a/lib/gitlab/middleware/unauthenticated_session_expiry.rb b/lib/gitlab/middleware/unauthenticated_session_expiry.rb index f240a6b23bd..7c5c523c287 100644 --- a/lib/gitlab/middleware/unauthenticated_session_expiry.rb +++ b/lib/gitlab/middleware/unauthenticated_session_expiry.rb @@ -18,8 +18,9 @@ module Gitlab result = @app.call(env) warden = env['warden'] + user = catch(:warden) { warden && warden.user } # rubocop:disable Cop/BanCatchThrow -- ignore Warden errors since we're outside Warden::Manager - unless warden && warden.user + unless user # This works because Rack uses these options every time a request is handled, and redis-store # uses the Rack setting first: # 1. https://github.com/rack/rack/blob/fdcd03a3c5a1c51d1f96fc97f9dfa1a9deac0c77/lib/rack/session/abstract/id.rb#L342 |