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
f233c3bc
Commit
f233c3bc
authored
Dec 10, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a frozen string error in lib/gitlab/utils.rb
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
80eebd8e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
changelogs/unreleased/55116-runtimeerror-can-t-modify-frozen-string.yml
...eleased/55116-runtimeerror-can-t-modify-frozen-string.yml
+5
-0
lib/gitlab/utils.rb
lib/gitlab/utils.rb
+1
-1
spec/lib/gitlab/utils_spec.rb
spec/lib/gitlab/utils_spec.rb
+6
-0
No files found.
changelogs/unreleased/55116-runtimeerror-can-t-modify-frozen-string.yml
0 → 100644
View file @
f233c3bc
---
title
:
Fix a frozen string error in lib/gitlab/utils.rb
merge_request
:
23690
author
:
type
:
fixed
lib/gitlab/utils.rb
View file @
f233c3bc
...
...
@@ -60,7 +60,7 @@ module Gitlab
# Converts newlines into HTML line break elements
def
nlbr
(
str
)
ActionView
::
Base
.
full_sanitizer
.
sanitize
(
str
,
tags:
[]).
gsub
(
/\r?\n/
,
'<br>'
).
html_safe
ActionView
::
Base
.
full_sanitizer
.
sanitize
(
+
str
,
tags:
[]).
gsub
(
/\r?\n/
,
'<br>'
).
html_safe
end
def
remove_line_breaks
(
str
)
...
...
spec/lib/gitlab/utils_spec.rb
View file @
f233c3bc
...
...
@@ -44,6 +44,12 @@ describe Gitlab::Utils do
end
end
describe
'.nlbr'
do
it
'replaces new lines with <br>'
do
expect
(
described_class
.
nlbr
(
"<b>hello</b>
\n
<i>world</i>"
.
freeze
)).
to
eq
(
"hello<br>world"
)
end
end
describe
'.remove_line_breaks'
do
using
RSpec
::
Parameterized
::
TableSyntax
...
...
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