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
Léo-Paul Géneau
gitlab-ce
Commits
208e07fe
Commit
208e07fe
authored
Aug 01, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix errors deleting and creating branches with encoded slashes
Closes #1804
parent
bdb4288a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
3 deletions
+25
-3
CHANGELOG
CHANGELOG
+1
-0
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+4
-3
spec/controllers/branches_controller_spec.rb
spec/controllers/branches_controller_spec.rb
+20
-0
No files found.
CHANGELOG
View file @
208e07fe
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 7.14.0 (unreleased)
v 7.14.0 (unreleased)
- Fix errors deleting and creating branches with encoded slashes (Stan Hu)
- Fix multi-line syntax highlighting (Stan Hu)
- Fix multi-line syntax highlighting (Stan Hu)
- Fix network graph when branch name has single quotes (Stan Hu)
- Fix network graph when branch name has single quotes (Stan Hu)
- Upgrade gitlab_git to version 7.2.6 to fix Error 500 when creating network graphs (Stan Hu)
- Upgrade gitlab_git to version 7.2.6 to fix Error 500 when creating network graphs (Stan Hu)
...
...
app/controllers/projects/branches_controller.rb
View file @
208e07fe
...
@@ -17,7 +17,9 @@ class Projects::BranchesController < Projects::ApplicationController
...
@@ -17,7 +17,9 @@ class Projects::BranchesController < Projects::ApplicationController
def
create
def
create
branch_name
=
sanitize
(
strip_tags
(
params
[
:branch_name
]))
branch_name
=
sanitize
(
strip_tags
(
params
[
:branch_name
]))
branch_name
=
Addressable
::
URI
.
unescape
(
branch_name
)
ref
=
sanitize
(
strip_tags
(
params
[
:ref
]))
ref
=
sanitize
(
strip_tags
(
params
[
:ref
]))
ref
=
Addressable
::
URI
.
unescape
(
ref
)
result
=
CreateBranchService
.
new
(
project
,
current_user
).
result
=
CreateBranchService
.
new
(
project
,
current_user
).
execute
(
branch_name
,
ref
)
execute
(
branch_name
,
ref
)
...
@@ -32,9 +34,8 @@ class Projects::BranchesController < Projects::ApplicationController
...
@@ -32,9 +34,8 @@ class Projects::BranchesController < Projects::ApplicationController
end
end
def
destroy
def
destroy
status
=
DeleteBranchService
.
new
(
project
,
current_user
).
execute
(
params
[
:id
])
@branch_name
=
Addressable
::
URI
.
unescape
(
params
[
:id
])
@branch_name
=
params
[
:id
]
status
=
DeleteBranchService
.
new
(
project
,
current_user
).
execute
(
@branch_name
)
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
redirect_to
namespace_project_branches_path
(
@project
.
namespace
,
redirect_to
namespace_project_branches_path
(
@project
.
namespace
,
...
...
spec/controllers/branches_controller_spec.rb
View file @
208e07fe
...
@@ -54,6 +54,13 @@ describe Projects::BranchesController do
...
@@ -54,6 +54,13 @@ describe Projects::BranchesController do
let
(
:ref
)
{
"<script>alert('ref');</script>"
}
let
(
:ref
)
{
"<script>alert('ref');</script>"
}
it
{
is_expected
.
to
render_template
(
'new'
)
}
it
{
is_expected
.
to
render_template
(
'new'
)
}
end
end
context
"valid branch name with encoded slashes"
do
let
(
:branch
)
{
"feature%2Ftest"
}
let
(
:ref
)
{
"<script>alert('ref');</script>"
}
it
{
is_expected
.
to
render_template
(
'new'
)
}
it
{
project
.
repository
.
branch_names
.
include?
(
'feature/test'
)}
end
end
end
describe
"POST destroy"
do
describe
"POST destroy"
do
...
@@ -74,6 +81,19 @@ describe Projects::BranchesController do
...
@@ -74,6 +81,19 @@ describe Projects::BranchesController do
it
{
expect
(
subject
).
to
render_template
(
'destroy'
)
}
it
{
expect
(
subject
).
to
render_template
(
'destroy'
)
}
end
end
context
"valid branch name with unencoded slashes"
do
let
(
:branch
)
{
"improve/awesome"
}
it
{
expect
(
response
.
status
).
to
eq
(
200
)
}
it
{
expect
(
subject
).
to
render_template
(
'destroy'
)
}
end
context
"valid branch name with encoded slashes"
do
let
(
:branch
)
{
"improve%2Fawesome"
}
it
{
expect
(
response
.
status
).
to
eq
(
200
)
}
it
{
expect
(
subject
).
to
render_template
(
'destroy'
)
}
end
context
"invalid branch name, valid ref"
do
context
"invalid branch name, valid ref"
do
let
(
:branch
)
{
"no-branch"
}
let
(
:branch
)
{
"no-branch"
}
...
...
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