Commit 524c947e authored by Lin Jen-Shin's avatar Lin Jen-Shin

Add checks before redirect, remove status/trace

compatible urls, which were for javascripts
parent 43981250
......@@ -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]
......
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment