Commit ef0055b5 authored by Stan Hu's avatar Stan Hu

Fix bug where commit data would not appear in some subdirectories

The upgrade from Rails v4.1.2 to v4.1.9 (76aad9b7) caused slashes in a tree to be escaped automatically.
Using wildcard globs prevents this behavior.

Closes #1478, #1459
parent 439b9f50
...@@ -16,7 +16,7 @@ v 7.11.0 (unreleased) ...@@ -16,7 +16,7 @@ v 7.11.0 (unreleased)
- Don't crash when an MR from a fork has a cross-reference comment from the target project on of its commits. - Don't crash when an MR from a fork has a cross-reference comment from the target project on of its commits.
- Include commit comments in MR from a forked project. - Include commit comments in MR from a forked project.
- -
- - Fix bug where commit data would not appear in some subdirectories (Stan Hu)
- Fix bug where Slack service channel was not saved in admin template settings. (Stan Hu) - Fix bug where Slack service channel was not saved in admin template settings. (Stan Hu)
- Move snippets UI to fluid layout - Move snippets UI to fluid layout
- Improve UI for sidebar. Increase separation between navigation and content - Improve UI for sidebar. Increase separation between navigation and content
......
...@@ -435,7 +435,7 @@ Gitlab::Application.routes.draw do ...@@ -435,7 +435,7 @@ Gitlab::Application.routes.draw do
member do member do
# tree viewer logs # tree viewer logs
get 'logs_tree', constraints: { id: Gitlab::Regex.git_reference_regex } get 'logs_tree', constraints: { id: Gitlab::Regex.git_reference_regex }
get 'logs_tree/:path' => 'refs#logs_tree', as: :logs_file, constraints: { get 'logs_tree/*path' => 'refs#logs_tree', as: :logs_file, constraints: {
id: Gitlab::Regex.git_reference_regex, id: Gitlab::Regex.git_reference_regex,
path: /.*/ path: /.*/
} }
......
...@@ -2,6 +2,8 @@ require 'spec_helper' ...@@ -2,6 +2,8 @@ require 'spec_helper'
describe ExtractsPath do describe ExtractsPath do
include ExtractsPath include ExtractsPath
include RepoHelpers
include Rails.application.routes.url_helpers
let(:project) { double('project') } let(:project) { double('project') }
...@@ -11,6 +13,20 @@ describe ExtractsPath do ...@@ -11,6 +13,20 @@ describe ExtractsPath do
project.stub(path_with_namespace: 'gitlab/gitlab-ci') project.stub(path_with_namespace: 'gitlab/gitlab-ci')
end end
describe '#assign_ref' do
let(:ref) { sample_commit[:id] }
let(:params) { {path: sample_commit[:line_code_path], ref: ref} }
before do
@project = create(:project)
end
it "log tree path should have no escape sequences" do
assign_ref_vars
expect(@logs_path).to eq("/#{@project.path_with_namespace}/refs/#{ref}/logs_tree/files/ruby/popen.rb")
end
end
describe '#extract_ref' do describe '#extract_ref' do
it "returns an empty pair when no @project is set" do it "returns an empty pair when no @project is set" do
@project = nil @project = nil
......
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