Commit 61891c26 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'fix-jira-user-agent' into 'master'

Fix user agent string for Hosted Jira

Closes #10737

See merge request gitlab-org/gitlab-ee!10545
parents 13ec1bcb b27e5497
---
title: Fix user agent string for Hosted Jira
merge_request: 10545
author:
type: fixed
......@@ -4,7 +4,7 @@ module Gitlab
module Jira
class Middleware
def self.jira_dvcs_connector?(env)
env['HTTP_USER_AGENT']&.start_with?('JIRA DVCS Connector')
env['HTTP_USER_AGENT']&.downcase&.start_with?('jira dvcs connector')
end
def initialize(app)
......
......@@ -10,6 +10,10 @@ describe Gitlab::Jira::Middleware do
expect(described_class.jira_dvcs_connector?('HTTP_USER_AGENT' => jira_user_agent)).to eq(true)
end
it 'returns true if user agent starts with "Jira DVCS Connector"' do
expect(described_class.jira_dvcs_connector?('HTTP_USER_AGENT' => 'Jira DVCS Connector')).to eq(true)
end
it 'returns false when not DVCS connector' do
expect(described_class.jira_dvcs_connector?('HTTP_USER_AGENT' => 'pokemon')).to eq(false)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment