diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-04-28 15:46:36 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-05-06 14:44:02 +0300 |
commit | c99f4e9314dea373b1507fbad7250e9cb8588363 (patch) | |
tree | 548fc84267625b6b39ec065778a34c90ad1d262d | |
parent | fe38be8be459eaf987e734b16074e22f3a88b5b8 (diff) | |
download | gitlab-ce-c99f4e9314dea373b1507fbad7250e9cb8588363.tar.gz |
Merge branch 'fix-commit-data-url-generation' into 'master'
Fix bug where commit data would not appear in some subdirectories
Fix issue where commit data would not show up in some subdirectories due to escaped slashes. For example:
https://gitlab.common-lisp.net/ecl/ecl/tree/develop/src/gc (now patched with fix)
The upgrade from Rails v4.1.2 to v4.1.9 (76aad9b76ed) caused slashes in a tree to be escaped automatically. Using a wildcard glob in the route prevents this behavior.
* Closes #1478, #1459
* Closes https://github.com/gitlabhq/gitlabhq/issues/9037
See merge request !581
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | config/routes.rb | 2 | ||||
-rw-r--r-- | spec/lib/extracts_path_spec.rb | 16 |
3 files changed, 19 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG index 7165513b506..2eec1d6a503 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -34,6 +34,8 @@ v 7.10.0 (unreleased) - Fix bug where commit data would not appear in some subdirectories (Stan Hu) - Unescape branch names in compare commit (Stan Hu) - + - + - 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) - Move snippets UI to fluid layout - Improve UI for sidebar. Increase separation between navigation and content diff --git a/config/routes.rb b/config/routes.rb index 744a99feded..e08ef6fc048 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -433,7 +433,7 @@ Gitlab::Application.routes.draw do member do # tree viewer logs 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, path: /.*/ } diff --git a/spec/lib/extracts_path_spec.rb b/spec/lib/extracts_path_spec.rb index ac602eac154..05bcebaa3a2 100644 --- a/spec/lib/extracts_path_spec.rb +++ b/spec/lib/extracts_path_spec.rb @@ -2,6 +2,8 @@ require 'spec_helper' describe ExtractsPath do include ExtractsPath + include RepoHelpers + include Rails.application.routes.url_helpers let(:project) { double('project') } @@ -11,6 +13,20 @@ describe ExtractsPath do project.stub(path_with_namespace: 'gitlab/gitlab-ci') 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 it "returns an empty pair when no @project is set" do @project = nil |