Skip to content
Snippets Groups Projects
Commit d7bbee75 authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files

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 `/`
parent e01c421b
No related branches found
No related tags found
1 merge request!5142Add a download buttons for Build Artifacts
Pipeline #
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment