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 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
|
||||||
|
|
||||||
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]
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
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
|
||||||
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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue