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
Boxiang Sun
gitlab-ce
Commits
bb48a0fa
Commit
bb48a0fa
authored
Aug 18, 2016
by
winniehell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not escape URI when extracting path (!5878)
parent
f3ee7fc8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
20 deletions
+4
-20
CHANGELOG
CHANGELOG
+1
-0
lib/extracts_path.rb
lib/extracts_path.rb
+3
-9
spec/lib/extracts_path_spec.rb
spec/lib/extracts_path_spec.rb
+0
-11
No files found.
CHANGELOG
View file @
bb48a0fa
...
...
@@ -29,6 +29,7 @@ v 8.11.0 (unreleased)
- Fix CI status icon link underline (ClemMakesApps)
- The Repository class is now instrumented
- Fix commit mention font inconsistency (ClemMakesApps)
- Do not escape URI when extracting path !5878 (winniehell)
- Fix filter label tooltip HTML rendering (ClemMakesApps)
- Cache the commit author in RequestStore to avoid extra lookups in PostReceive
- Expand commit message width in repo view (ClemMakesApps)
...
...
lib/extracts_path.rb
View file @
bb48a0fa
...
...
@@ -94,7 +94,9 @@ module ExtractsPath
@options
=
params
.
select
{
|
key
,
value
|
allowed_options
.
include?
(
key
)
&&
!
value
.
blank?
}
@options
=
HashWithIndifferentAccess
.
new
(
@options
)
@id
=
Addressable
::
URI
.
normalize_component
(
get_id
)
@id
=
params
[
:id
]
||
params
[
:ref
]
@id
+=
"/"
+
params
[
:path
]
unless
params
[
:path
].
blank?
@ref
,
@path
=
extract_ref
(
@id
)
@repo
=
@project
.
repository
if
@options
[
:extended_sha1
].
blank?
...
...
@@ -116,12 +118,4 @@ module ExtractsPath
def
tree
@tree
||=
@repo
.
tree
(
@commit
.
id
,
@path
)
end
private
def
get_id
id
=
params
[
:id
]
||
params
[
:ref
]
id
+=
"/"
+
params
[
:path
]
unless
params
[
:path
].
blank?
id
end
end
spec/lib/extracts_path_spec.rb
View file @
bb48a0fa
...
...
@@ -30,17 +30,6 @@ 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 slash character in ref'
do
let
(
:ref
)
{
'improve%2Fawesome'
}
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'
}
...
...
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