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
Jérome Perrin
gitlab-ce
Commits
a31e0aff
Commit
a31e0aff
authored
Sep 12, 2017
by
Micael Bergeron
Committed by
Rémy Coutable
Sep 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Error 500 in non-UTF8 branch names"
parent
30db01b2
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
2 deletions
+30
-2
changelogs/unreleased/37025-error-500-in-non-utf8-branch-names.yml
...s/unreleased/37025-error-500-in-non-utf8-branch-names.yml
+4
-0
lib/gitlab/git.rb
lib/gitlab/git.rb
+1
-1
spec/controllers/projects/branches_controller_spec.rb
spec/controllers/projects/branches_controller_spec.rb
+15
-0
spec/lib/gitlab/data_builder/push_spec.rb
spec/lib/gitlab/data_builder/push_spec.rb
+1
-1
spec/lib/gitlab/git_spec.rb
spec/lib/gitlab/git_spec.rb
+9
-0
No files found.
changelogs/unreleased/37025-error-500-in-non-utf8-branch-names.yml
0 → 100644
View file @
a31e0aff
---
title
:
Fixed non-UTF-8 valid branch names from causing an error.
merge_request
:
14090
type
:
fixed
lib/gitlab/git.rb
View file @
a31e0aff
...
...
@@ -11,7 +11,7 @@ module Gitlab
include
Gitlab
::
EncodingHelper
def
ref_name
(
ref
)
encode
!
ref
.
sub
(
/\Arefs\/(tags|heads|remotes)\//
,
''
)
encode
_utf8
(
ref
)
.
sub
(
/\Arefs\/(tags|heads|remotes)\//
,
''
)
end
def
branch_name
(
ref
)
...
...
spec/controllers/projects/branches_controller_spec.rb
View file @
a31e0aff
...
...
@@ -367,5 +367,20 @@ describe Projects::BranchesController do
expect
(
parsed_response
.
first
).
to
eq
'master'
end
end
context
'when branch contains an invalid UTF-8 sequence'
do
before
do
project
.
repository
.
create_branch
(
"wrong-
\xE5
-utf8-sequence"
)
end
it
'return with a status 200'
do
get
:index
,
namespace_id:
project
.
namespace
,
project_id:
project
,
format: :html
expect
(
response
).
to
have_http_status
(
200
)
end
end
end
end
spec/lib/gitlab/data_builder/push_spec.rb
View file @
a31e0aff
...
...
@@ -47,7 +47,7 @@ describe Gitlab::DataBuilder::Push do
include_examples
'deprecated repository hook data'
it
'does not raise an error when given nil commits'
do
expect
{
described_class
.
build
(
spy
,
spy
,
spy
,
spy
,
spy
,
nil
)
}
expect
{
described_class
.
build
(
spy
,
spy
,
spy
,
spy
,
'refs/tags/v1.1.0'
,
nil
)
}
.
not_to
raise_error
end
end
...
...
spec/lib/gitlab/git_spec.rb
View file @
a31e0aff
# coding: utf-8
require
'spec_helper'
describe
Gitlab
::
Git
do
...
...
@@ -29,4 +30,12 @@ describe Gitlab::Git do
end
end
end
describe
'.ref_name'
do
it
'ensure ref is a valid UTF-8 string'
do
utf8_invalid_ref
=
Gitlab
::
Git
::
BRANCH_REF_PREFIX
+
"an_invalid_ref_
\xE5
"
expect
(
described_class
.
ref_name
(
utf8_invalid_ref
)).
to
eq
(
"an_invalid_ref_å"
)
end
end
end
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