Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
68cea38e
Commit
68cea38e
authored
Aug 11, 2016
by
Elliot
Committed by
Rémy Coutable
Aug 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix front-end for branches that happen to contain urlencoding escape characters (e.g. %)
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
3a46eac1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
4 deletions
+18
-4
CHANGELOG
CHANGELOG
+1
-0
lib/extracts_path.rb
lib/extracts_path.rb
+1
-1
spec/lib/extracts_path_spec.rb
spec/lib/extracts_path_spec.rb
+16
-3
No files found.
CHANGELOG
View file @
68cea38e
...
@@ -5,6 +5,7 @@ v 8.11.0 (unreleased)
...
@@ -5,6 +5,7 @@ v 8.11.0 (unreleased)
- Fix rename `add_users_into_project` and `projects_ids`. !20512 (herminiotorres)
- Fix rename `add_users_into_project` and `projects_ids`. !20512 (herminiotorres)
- Fix the title of the toggle dropdown button. !5515 (herminiotorres)
- Fix the title of the toggle dropdown button. !5515 (herminiotorres)
- Improve diff performance by eliminating redundant checks for text blobs
- Improve diff performance by eliminating redundant checks for text blobs
- Ensure that branch names containing escapable characters (e.g. %20) aren't unescaped indiscriminately. !5770 (ewiltshi)
- Convert switch icon into icon font (ClemMakesApps)
- Convert switch icon into icon font (ClemMakesApps)
- API: Endpoints for enabling and disabling deploy keys
- API: Endpoints for enabling and disabling deploy keys
- Use long options for curl examples in documentation !5703 (winniehell)
- Use long options for curl examples in documentation !5703 (winniehell)
...
...
lib/extracts_path.rb
View file @
68cea38e
...
@@ -94,7 +94,7 @@ module ExtractsPath
...
@@ -94,7 +94,7 @@ module ExtractsPath
@options
=
params
.
select
{
|
key
,
value
|
allowed_options
.
include?
(
key
)
&&
!
value
.
blank?
}
@options
=
params
.
select
{
|
key
,
value
|
allowed_options
.
include?
(
key
)
&&
!
value
.
blank?
}
@options
=
HashWithIndifferentAccess
.
new
(
@options
)
@options
=
HashWithIndifferentAccess
.
new
(
@options
)
@id
=
Addressable
::
URI
.
unescape
(
get_id
)
@id
=
Addressable
::
URI
.
normalize_component
(
get_id
)
@ref
,
@path
=
extract_ref
(
@id
)
@ref
,
@path
=
extract_ref
(
@id
)
@repo
=
@project
.
repository
@repo
=
@project
.
repository
if
@options
[
:extended_sha1
].
blank?
if
@options
[
:extended_sha1
].
blank?
...
...
spec/lib/extracts_path_spec.rb
View file @
68cea38e
...
@@ -30,15 +30,28 @@ describe ExtractsPath, lib: true do
...
@@ -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"
)
expect
(
@logs_path
).
to
eq
(
"/
#{
@project
.
path_with_namespace
}
/refs/
#{
ref
}
/logs_tree/files/ruby/popen.rb"
)
end
end
context
'escaped s
equences
in ref'
do
context
'escaped s
lash character
in ref'
do
let
(
:ref
)
{
"improve%2Fawesome"
}
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
assign_ref_vars
expect
(
@ref
).
to
eq
(
'improve/awesome'
)
expect
(
@ref
).
to
eq
(
'improve/awesome'
)
expect
(
@logs_path
).
to
eq
(
"/
#{
@project
.
path_with_namespace
}
/refs/
#{
ref
}
/logs_tree/files/ruby/popen.rb"
)
expect
(
@logs_path
).
to
eq
(
"/
#{
@project
.
path_with_namespace
}
/refs/
#{
ref
}
/logs_tree/files/ruby/popen.rb"
)
end
end
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
end
describe
'#extract_ref'
do
describe
'#extract_ref'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment