Skip to content
Snippets Groups Projects
Commit c644501f authored by Vasilii Iakliushin's avatar Vasilii Iakliushin :palm_tree:
Browse files

Projects::GraphsController#charts: fix URL generation

Contributes to #496469

**Problem**

project_graph_path doesn't use @ref with an extracted reference in
GraphsController. The URL generation fails and returns a 500 error.

**Solution**

Provide a correct reference object to project_graph_path

Changelog: fixed
parent 7c455e1f
No related branches found
No related tags found
2 merge requests!170053Security patch upgrade alert: Only expose to admins 17-4,!167616Projects::GraphsController#charts: fix URL generation
......@@ -31,7 +31,7 @@
.col-md-6
.tree-ref-container
.tree-ref-holder
#js-project-graph-ref-switcher{ data: { project_id: @project.id, graph_path: project_graph_path(@project, @id), project_branch: current_ref } }
#js-project-graph-ref-switcher{ data: { project_id: @project.id, graph_path: project_graph_path(@project, @ref), project_branch: current_ref } }
%ul.breadcrumb.repo-breadcrumb
= commits_breadcrumbs
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Projects::GraphsController, feature_category: :source_code_management do
let_it_be(:project) { create(:project, :repository, :private) }
let(:ref) { 'master' }
describe 'GET #charts' do
subject(:send_request) { get charts_project_graph_path(project, ref), params: params }
let(:params) { {} }
context 'when user is unauthorized' do
it 'shows 404' do
send_request
expect(response).to redirect_to(new_user_session_path)
end
end
context 'when user is authorized' do
let(:user) { project.creator }
before do
sign_in(user)
end
it 'renders content' do
send_request
expect(response).to be_successful
end
context 'when path includes a space' do
let(:params) { { path: 'a b' } }
it 'still renders the page' do
send_request
expect(response).to have_gitlab_http_status(:ok)
end
end
end
end
end
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