Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-08-11 16:03:09 +0300
committerRémy Coutable <remy@rymai.me>2016-08-11 16:03:09 +0300
commita081b842f9b4e0205cf08656403e6bd9bf0d367f (patch)
tree9e0adad05236453ee98f6e739b4103a68e27cc41 /spec
parent2fee83376788574824192ff2ac417edc9adfadb4 (diff)
parent68cea38e94886e69099a3faa0d1e2fbde2e71899 (diff)
Merge branch '10772-fix-urlencoded-branchname' into 'master'
Fix front-end for branches that happen to contain urlencoding escape characters (e.g. %) _Originally opened at !3574 by @ewiltshi._ - - - Adding a branch with a name like "foo%20bar" (via command-line) and setting it to the project's default branch causes the project "show" page to 404 for that project. "assign_ref_vars" unescapes the branch name ("foo%20bar" ==> "foo bar"), making GitLab look for a non-existent branch. This MR adds logic to skip the URL unescaping step in "assign_ref_vars". Fixes #10772, #14992, #15304. ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - Tests - [x] Added for this feature/bug - [ ] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !5770
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/extracts_path_spec.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/spec/lib/extracts_path_spec.rb b/spec/lib/extracts_path_spec.rb
index b12a7b98d4d..36c77206a3f 100644
--- a/spec/lib/extracts_path_spec.rb
+++ b/spec/lib/extracts_path_spec.rb
@@ -30,15 +30,28 @@ describe ExtractsPath, lib: true do
expect(@logs_path).to eq("/#{@project.path_with_namespace}/refs/#{ref}/logs_tree/files/ruby/popen.rb")
end
- context 'escaped sequences in ref' do
- let(:ref) { "improve%2Fawesome" }
+ context 'escaped slash character in ref' do
+ let(:ref) { 'improve%2Fawesome' }
- it "id has no escape sequences" do
+ it 'has no escape sequences in @ref or @logs_path' do
assign_ref_vars
+
expect(@ref).to eq('improve/awesome')
expect(@logs_path).to eq("/#{@project.path_with_namespace}/refs/#{ref}/logs_tree/files/ruby/popen.rb")
end
end
+
+ context 'ref contains %20' do
+ let(:ref) { 'foo%20bar' }
+
+ it 'is not converted to a space in @id' do
+ @project.repository.add_branch(@project.owner, 'foo%20bar', 'master')
+
+ assign_ref_vars
+
+ expect(@id).to start_with('foo%20bar/')
+ end
+ end
end
describe '#extract_ref' do