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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
fd692d10
Commit
fd692d10
authored
Jul 12, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bugfix-htmlenc' into 'master'
decode user/namespace names before display See merge request !10085
parents
61ec2f30
4f47de62
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletion
+17
-1
app/models/user.rb
app/models/user.rb
+1
-1
changelogs/unreleased/10085-stop-encoding-user-name.yml
changelogs/unreleased/10085-stop-encoding-user-name.yml
+4
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+12
-0
No files found.
app/models/user.rb
View file @
fd692d10
...
@@ -699,7 +699,7 @@ class User < ActiveRecord::Base
...
@@ -699,7 +699,7 @@ class User < ActiveRecord::Base
end
end
def
sanitize_attrs
def
sanitize_attrs
%w[
name
username skype linkedin twitter]
.
each
do
|
attr
|
%w[username skype linkedin twitter]
.
each
do
|
attr
|
value
=
public_send
(
attr
)
value
=
public_send
(
attr
)
public_send
(
"
#{
attr
}
="
,
Sanitize
.
clean
(
value
))
if
value
.
present?
public_send
(
"
#{
attr
}
="
,
Sanitize
.
clean
(
value
))
if
value
.
present?
end
end
...
...
changelogs/unreleased/10085-stop-encoding-user-name.yml
0 → 100644
View file @
fd692d10
---
title
:
"
Insert
user
name
directly
without
encoding"
merge_request
:
10085
author
:
Nathan Neulinger <nneul@neulinger.org>
spec/models/user_spec.rb
View file @
fd692d10
...
@@ -1159,6 +1159,18 @@ describe User, models: true do
...
@@ -1159,6 +1159,18 @@ describe User, models: true do
end
end
end
end
describe
'#sanitize_attrs'
do
let
(
:user
)
{
build
(
:user
,
name:
'test & user'
,
skype:
'test&user'
)
}
it
'encodes HTML entities in the Skype attribute'
do
expect
{
user
.
sanitize_attrs
}.
to
change
{
user
.
skype
}.
to
(
'test&user'
)
end
it
'does not encode HTML entities in the name attribute'
do
expect
{
user
.
sanitize_attrs
}.
not_to
change
{
user
.
name
}
end
end
describe
'#starred?'
do
describe
'#starred?'
do
it
'determines if user starred a project'
do
it
'determines if user starred a project'
do
user
=
create
:user
user
=
create
:user
...
...
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