BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
4f47de62
Commit
4f47de62
authored
Apr 10, 2017
by
Nathan Neulinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop sanitizing user 'name' when inserting into db
Add spec tests for encoding
parent
571c4f5a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletion
+17
-1
user.rb
app/models/user.rb
+1
-1
10085-stop-encoding-user-name.yml
changelogs/unreleased/10085-stop-encoding-user-name.yml
+4
-0
user_spec.rb
spec/models/user_spec.rb
+12
-0
No files found.
app/models/user.rb
View file @
4f47de62
...
...
@@ -699,7 +699,7 @@ class User < ActiveRecord::Base
end
def
sanitize_attrs
%w[
name
username skype linkedin twitter]
.
each
do
|
attr
|
%w[username skype linkedin twitter]
.
each
do
|
attr
|
value
=
public_send
(
attr
)
public_send
(
"
#{
attr
}
="
,
Sanitize
.
clean
(
value
))
if
value
.
present?
end
...
...
changelogs/unreleased/10085-stop-encoding-user-name.yml
0 → 100644
View file @
4f47de62
---
title
:
"
Insert
user
name
directly
without
encoding"
merge_request
:
10085
author
:
Nathan Neulinger <nneul@neulinger.org>
spec/models/user_spec.rb
View file @
4f47de62
...
...
@@ -1159,6 +1159,18 @@ describe User, models: true do
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
it
'determines if user starred a project'
do
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