Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
10e02e58
Commit
10e02e58
authored
Oct 16, 2019
by
Arturo Herrero
Committed by
Mayra Cabrera
Oct 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JIRA Integration: Fix API URL with trailing slash
JIRA URL works with trailing slash, this fixes the API URL.
parent
d1068ca1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
10 deletions
+37
-10
app/models/project_services/jira_service.rb
app/models/project_services/jira_service.rb
+6
-2
changelogs/unreleased/14945-fix-jira-api-url-parsing.yml
changelogs/unreleased/14945-fix-jira-api-url-parsing.yml
+5
-0
spec/models/project_services/jira_service_spec.rb
spec/models/project_services/jira_service_spec.rb
+26
-8
No files found.
app/models/project_services/jira_service.rb
View file @
10e02e58
...
...
@@ -122,9 +122,13 @@ class JiraService < IssueTrackerService
end
alias_method
:original_url
,
:url
def
url
original_url
&
.
chomp
(
'/'
)
original_url
&
.
delete_suffix
(
'/'
)
end
alias_method
:original_api_url
,
:api_url
def
api_url
original_api_url
&
.
delete_suffix
(
'/'
)
end
def
execute
(
push
)
...
...
changelogs/unreleased/14945-fix-jira-api-url-parsing.yml
0 → 100644
View file @
10e02e58
---
title
:
'
JIRA
Integration
API
URL
works
having
a
trailing
slash'
merge_request
:
18526
author
:
type
:
fixed
spec/models/project_services/jira_service_spec.rb
View file @
10e02e58
...
...
@@ -15,20 +15,22 @@ describe JiraService do
let
(
:transition_id
)
{
'test27'
}
describe
'#options'
do
let
(
:
service
)
do
described_class
.
create
(
let
(
:
options
)
do
{
project:
create
(
:project
),
active:
true
,
username:
'username
'
,
username:
'username'
,
password:
'test'
,
jira_issue_transition_id:
24
,
url:
'http://jira.test.com/path/'
)
}
end
let
(
:service
)
{
described_class
.
create
(
options
)
}
it
'sets the URL properly'
do
# jira-ruby gem parses the URI and handles trailing slashes
#
fine: https://github.com/sumoheavy/jira-ruby/blob/v1.4.1/lib/jira/http_client.rb#L59
# jira-ruby gem parses the URI and handles trailing slashes
fine:
#
https://github.com/sumoheavy/jira-ruby/blob/v1.7.0/lib/jira/http_client.rb#L62
expect
(
service
.
options
[
:site
]).
to
eq
(
'http://jira.test.com/'
)
end
...
...
@@ -36,14 +38,30 @@ describe JiraService do
expect
(
service
.
options
[
:context_path
]).
to
eq
(
'/path'
)
end
it
'leaves out trailing whitespaces in username'
do
expect
(
service
.
options
[
:username
]).
to
eq
(
'username'
)
context
'username with trailing whitespaces'
do
before
do
options
.
merge!
(
username:
'username '
)
end
it
'leaves out trailing whitespaces in username'
do
expect
(
service
.
options
[
:username
]).
to
eq
(
'username'
)
end
end
it
'provides additional cookies to allow basic auth with oracle webgate'
do
expect
(
service
.
options
[
:use_cookies
]).
to
eq
(
true
)
expect
(
service
.
options
[
:additional_cookies
]).
to
eq
([
'OBBasicAuth=fromDialog'
])
end
context
'using api URL'
do
before
do
options
.
merge!
(
api_url:
'http://jira.test.com/api_path/'
)
end
it
'leaves out trailing slashes in context'
do
expect
(
service
.
options
[
:context_path
]).
to
eq
(
'/api_path'
)
end
end
end
describe
'Associations'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment