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
5d11cf2e
Commit
5d11cf2e
authored
Jun 29, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use CGI.unescapeHTML rather than doing the gsub with a map
parent
d6b60e83
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
12 deletions
+2
-12
app/models/label.rb
app/models/label.rb
+1
-11
lib/banzai/filter/label_reference_filter.rb
lib/banzai/filter/label_reference_filter.rb
+1
-1
No files found.
app/models/label.rb
View file @
5d11cf2e
...
@@ -10,12 +10,6 @@ class Label < ActiveRecord::Base
...
@@ -10,12 +10,6 @@ class Label < ActiveRecord::Base
DEFAULT_COLOR
=
'#428BCA'
DEFAULT_COLOR
=
'#428BCA'
TABLE_FOR_ESCAPE_HTML_ENTITIES
=
{
'&'
=>
'&'
,
'<'
=>
'<'
,
'>'
=>
'>'
}
default_value_for
:color
,
DEFAULT_COLOR
default_value_for
:color
,
DEFAULT_COLOR
belongs_to
:project
belongs_to
:project
...
@@ -140,10 +134,6 @@ class Label < ActiveRecord::Base
...
@@ -140,10 +134,6 @@ class Label < ActiveRecord::Base
end
end
def
sanitize_title
(
value
)
def
sanitize_title
(
value
)
unescape_html_entities
(
Sanitize
.
clean
(
value
.
to_s
))
CGI
.
unescapeHTML
(
Sanitize
.
clean
(
value
.
to_s
))
end
def
unescape_html_entities
(
value
)
value
.
to_s
.
gsub
(
/(>)|(<)|(&)/
,
TABLE_FOR_ESCAPE_HTML_ENTITIES
.
invert
)
end
end
end
end
lib/banzai/filter/label_reference_filter.rb
View file @
5d11cf2e
...
@@ -68,7 +68,7 @@ module Banzai
...
@@ -68,7 +68,7 @@ module Banzai
end
end
def
unescape_html_entities
(
text
)
def
unescape_html_entities
(
text
)
text
.
to_s
.
gsub
(
/(>)|(<)|(&)/
,
Label
::
TABLE_FOR_ESCAPE_HTML_ENTITIES
.
invert
)
CGI
.
unescapeHTML
(
text
.
to_s
)
end
end
end
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