Add checks before redirect, remove status/trace
compatible urls, which were for javascripts
This commit is contained in:
parent
43981250c4
commit
524c947eaf
4 changed files with 8 additions and 38 deletions
|
@ -2,7 +2,9 @@ class Projects::BuildArtifactsController < Projects::ApplicationController
|
|||
include ExtractsPath
|
||||
include RendersBlob
|
||||
|
||||
before_action :authorize_read_build!
|
||||
before_action :extract_ref_name_and_path
|
||||
before_action :validate_artifacts!
|
||||
|
||||
def download
|
||||
redirect_to download_namespace_project_job_artifacts_path(project.namespace, project, job)
|
||||
|
@ -26,6 +28,10 @@ class Projects::BuildArtifactsController < Projects::ApplicationController
|
|||
|
||||
private
|
||||
|
||||
def validate_artifacts!
|
||||
render_404 unless job && job.artifacts?
|
||||
end
|
||||
|
||||
def extract_ref_name_and_path
|
||||
return unless params[:ref_name_and_path]
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
class Projects::BuildsController < Projects::ApplicationController
|
||||
before_action :authorize_read_build!
|
||||
|
||||
def index
|
||||
redirect_to namespace_project_jobs_path(project.namespace, project)
|
||||
end
|
||||
|
@ -7,14 +9,6 @@ class Projects::BuildsController < Projects::ApplicationController
|
|||
redirect_to namespace_project_job_path(project.namespace, project, job)
|
||||
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
|
||||
redirect_to raw_namespace_project_job_path(project.namespace, project, job)
|
||||
end
|
||||
|
|
|
@ -22,8 +22,6 @@ module Gitlab
|
|||
end
|
||||
|
||||
member do
|
||||
get :status
|
||||
get :trace, defaults: { format: 'json' }
|
||||
get :raw
|
||||
end
|
||||
|
||||
|
|
|
@ -498,20 +498,6 @@ feature 'Jobs', :feature do
|
|||
|
||||
it { expect(page.status_code).to eq(404) }
|
||||
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
|
||||
|
||||
describe "GET /:project/jobs/:id/status" do
|
||||
|
@ -530,19 +516,5 @@ feature 'Jobs', :feature do
|
|||
|
||||
it { expect(page.status_code).to eq(404) }
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue