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
15ca2d5f
Commit
15ca2d5f
authored
Feb 19, 2018
by
Travis Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix get a single pages domain when project path contains a period
parent
557db7e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
5 deletions
+23
-5
changelogs/unreleased/40668-pages-domain-api-returns-404-when-using-a-specific-domain.yml
...s-domain-api-returns-404-when-using-a-specific-domain.yml
+5
-0
lib/api/pages_domains.rb
lib/api/pages_domains.rb
+6
-4
spec/requests/api/pages_domains_spec.rb
spec/requests/api/pages_domains_spec.rb
+12
-1
No files found.
changelogs/unreleased/40668-pages-domain-api-returns-404-when-using-a-specific-domain.yml
0 → 100644
View file @
15ca2d5f
---
title
:
Fix get a single pages domain when project path contains a period
merge_request
:
17206
author
:
Travis Miller
type
:
fixed
lib/api/pages_domains.rb
View file @
15ca2d5f
...
...
@@ -2,6 +2,8 @@ module API
class
PagesDomains
<
Grape
::
API
include
PaginationParams
PAGES_DOMAINS_ENDPOINT_REQUIREMENTS
=
API
::
PROJECT_ENDPOINT_REQUIREMENTS
.
merge
(
domain:
API
::
NO_SLASH_URL_PART_REGEX
)
before
do
authenticate!
end
...
...
@@ -48,7 +50,7 @@ module API
params
do
requires
:id
,
type:
String
,
desc:
'The ID of a project'
end
resource
:projects
,
requirements:
{
id:
%r{[^/]+}
}
do
resource
:projects
,
requirements:
API
::
PROJECT_ENDPOINT_REQUIREMENTS
do
before
do
require_pages_enabled!
end
...
...
@@ -71,7 +73,7 @@ module API
params
do
requires
:domain
,
type:
String
,
desc:
'The domain'
end
get
":id/pages/domains/:domain"
,
requirements:
{
domain:
%r{[^/]+}
}
do
get
":id/pages/domains/:domain"
,
requirements:
PAGES_DOMAINS_ENDPOINT_REQUIREMENTS
do
authorize!
:read_pages
,
user_project
present
pages_domain
,
with:
Entities
::
PagesDomain
...
...
@@ -105,7 +107,7 @@ module API
optional
:certificate
,
allow_blank:
false
,
types:
[
File
,
String
],
desc:
'The certificate'
optional
:key
,
allow_blank:
false
,
types:
[
File
,
String
],
desc:
'The key'
end
put
":id/pages/domains/:domain"
,
requirements:
{
domain:
%r{[^/]+}
}
do
put
":id/pages/domains/:domain"
,
requirements:
PAGES_DOMAINS_ENDPOINT_REQUIREMENTS
do
authorize!
:update_pages
,
user_project
pages_domain_params
=
declared
(
params
,
include_parent_namespaces:
false
)
...
...
@@ -126,7 +128,7 @@ module API
params
do
requires
:domain
,
type:
String
,
desc:
'The domain'
end
delete
":id/pages/domains/:domain"
,
requirements:
{
domain:
%r{[^/]+}
}
do
delete
":id/pages/domains/:domain"
,
requirements:
PAGES_DOMAINS_ENDPOINT_REQUIREMENTS
do
authorize!
:update_pages
,
user_project
status
204
...
...
spec/requests/api/pages_domains_spec.rb
View file @
15ca2d5f
require
'rails_helper'
describe
API
::
PagesDomains
do
set
(
:project
)
{
create
(
:project
)
}
set
(
:project
)
{
create
(
:project
,
path:
'my.project'
)
}
set
(
:user
)
{
create
(
:user
)
}
set
(
:admin
)
{
create
(
:admin
)
}
...
...
@@ -16,6 +16,7 @@ describe API::PagesDomains do
let
(
:route
)
{
"/projects/
#{
project
.
id
}
/pages/domains"
}
let
(
:route_domain
)
{
"/projects/
#{
project
.
id
}
/pages/domains/
#{
pages_domain
.
domain
}
"
}
let
(
:route_domain_path
)
{
"/projects/
#{
project
.
path_with_namespace
.
gsub
(
'/'
,
'%2F'
)
}
/pages/domains/
#{
pages_domain
.
domain
}
"
}
let
(
:route_secure_domain
)
{
"/projects/
#{
project
.
id
}
/pages/domains/
#{
pages_domain_secure
.
domain
}
"
}
let
(
:route_expired_domain
)
{
"/projects/
#{
project
.
id
}
/pages/domains/
#{
pages_domain_expired
.
domain
}
"
}
let
(
:route_vacant_domain
)
{
"/projects/
#{
project
.
id
}
/pages/domains/www.vacant-domain.test"
}
...
...
@@ -144,6 +145,16 @@ describe API::PagesDomains do
expect
(
json_response
[
'certificate'
]).
to
be_nil
end
it
'returns pages domain with project path'
do
get
api
(
route_domain_path
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/pages_domain/detail'
)
expect
(
json_response
[
'domain'
]).
to
eq
(
pages_domain
.
domain
)
expect
(
json_response
[
'url'
]).
to
eq
(
pages_domain
.
url
)
expect
(
json_response
[
'certificate'
]).
to
be_nil
end
it
'returns pages domain with a certificate'
do
get
api
(
route_secure_domain
,
user
)
...
...
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