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
589d1797
Commit
589d1797
authored
Jul 19, 2019
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle trailing slashes when generating Jira URLs
Applies to issues_url and new_issue_url
parent
695f4bb1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
2 deletions
+35
-2
app/models/project_services/jira_service.rb
app/models/project_services/jira_service.rb
+7
-1
changelogs/unreleased/63833-fix-jira-issues-url.yml
changelogs/unreleased/63833-fix-jira-issues-url.yml
+5
-0
spec/models/project_services/jira_service_spec.rb
spec/models/project_services/jira_service_spec.rb
+23
-1
No files found.
app/models/project_services/jira_service.rb
View file @
589d1797
...
...
@@ -54,7 +54,7 @@ class JiraService < IssueTrackerService
username:
self
.
username
,
password:
self
.
password
,
site:
URI
.
join
(
url
,
'/'
).
to_s
,
# Intended to find the root
context_path:
url
.
path
.
chomp
(
'/'
)
,
context_path:
url
.
path
,
auth_type: :basic
,
read_timeout:
120
,
use_cookies:
true
,
...
...
@@ -103,6 +103,12 @@ class JiraService < IssueTrackerService
"
#{
url
}
/secure/CreateIssue.jspa"
end
alias_method
:original_url
,
:url
def
url
original_url
&
.
chomp
(
'/'
)
end
def
execute
(
push
)
# This method is a no-op, because currently JiraService does not
# support any events.
...
...
changelogs/unreleased/63833-fix-jira-issues-url.yml
0 → 100644
View file @
589d1797
---
title
:
Handle trailing slashes when generating Jira issue URLs
merge_request
:
30911
author
:
type
:
fixed
spec/models/project_services/jira_service_spec.rb
View file @
589d1797
...
...
@@ -236,7 +236,7 @@ describe JiraService do
allow
(
JIRA
::
Resource
::
Remotelink
).
to
receive
(
:all
).
and_return
(
nil
)
expect
{
@jira_service
.
close_issue
(
resource
,
ExternalIssue
.
new
(
'JIRA-123'
,
project
))
}
.
not_to
raise_error
(
NoMethodError
)
.
not_to
raise_error
end
# Check https://developer.atlassian.com/jiradev/jira-platform/guides/other/guide-jira-remote-issue-links/fields-in-remote-issue-links
...
...
@@ -606,6 +606,12 @@ describe JiraService do
expect
(
service
.
properties
[
'api_url'
]).
to
eq
(
'http://jira.sample/api'
)
end
end
it
'removes trailing slashes from url'
do
service
=
described_class
.
new
(
url:
'http://jira.test.com/path/'
)
expect
(
service
.
url
).
to
eq
(
'http://jira.test.com/path'
)
end
end
describe
'favicon urls'
,
:request_store
do
...
...
@@ -621,4 +627,20 @@ describe JiraService do
expect
(
props
[
:object
][
:icon
][
:url16x16
]).
to
match
%r{^http://localhost/uploads/-/system/appearance/favicon/
\d
+/dk.png$}
end
end
context
'generating external URLs'
do
let
(
:service
)
{
described_class
.
new
(
url:
'http://jira.test.com/path/'
)
}
describe
'#issues_url'
do
it
'handles trailing slashes'
do
expect
(
service
.
issues_url
).
to
eq
(
'http://jira.test.com/path/browse/:id'
)
end
end
describe
'#new_issue_url'
do
it
'handles trailing slashes'
do
expect
(
service
.
new_issue_url
).
to
eq
(
'http://jira.test.com/path/secure/CreateIssue.jspa'
)
end
end
end
end
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