Update routes based on feedback from:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5142#note_13058785 And note that job/build_name could contain `/`
This commit is contained in:
parent
e01c421b91
commit
d7bbee7593
|
@ -61,7 +61,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
|
|||
|
||||
def build_from_ref
|
||||
if params[:ref_name]
|
||||
builds = project.builds_for(params[:build_name], params[:ref_name])
|
||||
builds = project.builds_for(params[:job], params[:ref_name])
|
||||
|
||||
builds.success.latest.first
|
||||
end
|
||||
|
|
|
@ -733,16 +733,17 @@ Rails.application.routes.draw do
|
|||
|
||||
resources :environments, only: [:index, :show, :new, :create, :destroy]
|
||||
|
||||
resources :artifacts, only: [] do
|
||||
collection do
|
||||
get :search, path: ':ref_name/:build_name/*path', format: false,
|
||||
constraints: { ref_name: /.+/ } # ref could have /
|
||||
end
|
||||
end
|
||||
|
||||
resources :builds, only: [:index, :show], constraints: { id: /\d+/ } do
|
||||
collection do
|
||||
post :cancel_all
|
||||
|
||||
resources :artifacts, only: [] do
|
||||
collection do
|
||||
get :search, path: ':ref_name/*path',
|
||||
format: false,
|
||||
constraints: { ref_name: /.+/ } # could have /
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
member do
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
|||
require_relative '../shared/artifacts_context'
|
||||
|
||||
describe Projects::ArtifactsController do
|
||||
describe 'GET /:project/artifacts/:ref/:build_name/browse' do
|
||||
describe 'GET /:project/builds/artifacts/:ref_name/browse?job=name' do
|
||||
include_context 'artifacts from ref and build name'
|
||||
|
||||
before do
|
||||
|
@ -10,13 +10,13 @@ describe Projects::ArtifactsController do
|
|||
end
|
||||
|
||||
def path_from_ref(
|
||||
ref = pipeline.sha, build_name = build.name, path = 'browse')
|
||||
ref = pipeline.sha, job = build.name, path = 'browse')
|
||||
search_namespace_project_artifacts_path(
|
||||
project.namespace,
|
||||
project,
|
||||
ref,
|
||||
build_name,
|
||||
path)
|
||||
path,
|
||||
job: job)
|
||||
end
|
||||
|
||||
context '404' do
|
||||
|
|
Loading…
Reference in New Issue