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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
524c947e
Commit
524c947e
authored
May 23, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add checks before redirect, remove status/trace
compatible urls, which were for javascripts
parent
43981250
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
38 deletions
+8
-38
app/controllers/projects/build_artifacts_controller.rb
app/controllers/projects/build_artifacts_controller.rb
+6
-0
app/controllers/projects/builds_controller.rb
app/controllers/projects/builds_controller.rb
+2
-8
lib/gitlab/routes/legacy_builds.rb
lib/gitlab/routes/legacy_builds.rb
+0
-2
spec/features/projects/jobs_spec.rb
spec/features/projects/jobs_spec.rb
+0
-28
No files found.
app/controllers/projects/build_artifacts_controller.rb
View file @
524c947e
...
@@ -2,7 +2,9 @@ class Projects::BuildArtifactsController < Projects::ApplicationController
...
@@ -2,7 +2,9 @@ class Projects::BuildArtifactsController < Projects::ApplicationController
include
ExtractsPath
include
ExtractsPath
include
RendersBlob
include
RendersBlob
before_action
:authorize_read_build!
before_action
:extract_ref_name_and_path
before_action
:extract_ref_name_and_path
before_action
:validate_artifacts!
def
download
def
download
redirect_to
download_namespace_project_job_artifacts_path
(
project
.
namespace
,
project
,
job
)
redirect_to
download_namespace_project_job_artifacts_path
(
project
.
namespace
,
project
,
job
)
...
@@ -26,6 +28,10 @@ class Projects::BuildArtifactsController < Projects::ApplicationController
...
@@ -26,6 +28,10 @@ class Projects::BuildArtifactsController < Projects::ApplicationController
private
private
def
validate_artifacts!
render_404
unless
job
&&
job
.
artifacts?
end
def
extract_ref_name_and_path
def
extract_ref_name_and_path
return
unless
params
[
:ref_name_and_path
]
return
unless
params
[
:ref_name_and_path
]
...
...
app/controllers/projects/builds_controller.rb
View file @
524c947e
class
Projects::BuildsController
<
Projects
::
ApplicationController
class
Projects::BuildsController
<
Projects
::
ApplicationController
before_action
:authorize_read_build!
def
index
def
index
redirect_to
namespace_project_jobs_path
(
project
.
namespace
,
project
)
redirect_to
namespace_project_jobs_path
(
project
.
namespace
,
project
)
end
end
...
@@ -7,14 +9,6 @@ class Projects::BuildsController < Projects::ApplicationController
...
@@ -7,14 +9,6 @@ class Projects::BuildsController < Projects::ApplicationController
redirect_to
namespace_project_job_path
(
project
.
namespace
,
project
,
job
)
redirect_to
namespace_project_job_path
(
project
.
namespace
,
project
,
job
)
end
end
def
trace
redirect_to
trace_namespace_project_job_path
(
project
.
namespace
,
project
,
job
,
format:
params
[
:format
])
end
def
status
redirect_to
status_namespace_project_job_path
(
project
.
namespace
,
project
,
job
,
format:
params
[
:format
])
end
def
raw
def
raw
redirect_to
raw_namespace_project_job_path
(
project
.
namespace
,
project
,
job
)
redirect_to
raw_namespace_project_job_path
(
project
.
namespace
,
project
,
job
)
end
end
...
...
lib/gitlab/routes/legacy_builds.rb
View file @
524c947e
...
@@ -22,8 +22,6 @@ module Gitlab
...
@@ -22,8 +22,6 @@ module Gitlab
end
end
member
do
member
do
get
:status
get
:trace
,
defaults:
{
format:
'json'
}
get
:raw
get
:raw
end
end
...
...
spec/features/projects/jobs_spec.rb
View file @
524c947e
...
@@ -498,20 +498,6 @@ feature 'Jobs', :feature do
...
@@ -498,20 +498,6 @@ feature 'Jobs', :feature do
it
{
expect
(
page
.
status_code
).
to
eq
(
404
)
}
it
{
expect
(
page
.
status_code
).
to
eq
(
404
)
}
end
end
context
"when visiting old URL"
do
let
(
:trace_job_url
)
do
trace_namespace_project_job_path
(
project
.
namespace
,
project
,
build
,
format: :json
)
end
before
do
visit
trace_job_url
.
sub
(
'jobs'
,
'builds'
)
end
it
"redirects to new URL"
do
expect
(
page
.
current_path
).
to
eq
(
trace_job_url
)
end
end
end
end
describe
"GET /:project/jobs/:id/status"
do
describe
"GET /:project/jobs/:id/status"
do
...
@@ -530,19 +516,5 @@ feature 'Jobs', :feature do
...
@@ -530,19 +516,5 @@ feature 'Jobs', :feature do
it
{
expect
(
page
.
status_code
).
to
eq
(
404
)
}
it
{
expect
(
page
.
status_code
).
to
eq
(
404
)
}
end
end
context
"when visiting old URL"
do
let
(
:status_job_url
)
do
status_namespace_project_job_path
(
project
.
namespace
,
project
,
build
)
end
before
do
visit
status_job_url
.
sub
(
'jobs'
,
'builds'
)
end
it
"redirects to new URL"
do
expect
(
page
.
current_path
).
to
eq
(
status_job_url
)
end
end
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