Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Admin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osuny
Admin
Commits
c9ab431a
Unverified
Commit
c9ab431a
authored
3 years ago
by
Sébastien Gaya
Browse files
Options
Downloads
Patches
Plain Diff
remove control chars and fix blob jekyll
parent
e698d5d1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/services/wordpress.rb
+5
-5
5 additions, 5 deletions
app/services/wordpress.rb
app/views/active_storage/blobs/jekyll.html.erb
+9
-7
9 additions, 7 deletions
app/views/active_storage/blobs/jekyll.html.erb
with
14 additions
and
12 deletions
app/services/wordpress.rb
+
5
−
5
View file @
c9ab431a
...
...
@@ -6,7 +6,7 @@ class Wordpress
string
=
string
.
gsub
(
' '
,
' '
)
string
=
string
.
gsub
(
'&'
,
'&'
)
string
=
ActionView
::
Base
.
full_sanitizer
.
sanitize
string
string
=
remove_
lsep
string
string
=
remove_
control_chars
string
string
end
...
...
@@ -36,13 +36,13 @@ class Wordpress
end
end
html
=
fragment
.
to_html
(
preserve_newline:
true
)
html
=
remove_
lsep
html
html
=
remove_
control_chars
html
html
end
def
self
.
remove_
lsep
(
string
)
# LSEP
is
invisible
!
string
=
string
.
delete
(
" "
,
"
"
,
"
"
)
def
self
.
remove_
control_chars
(
string
)
#
Control chars &
LSEP
are
invisible
or hard to detect
string
=
string
.
delete
(
" "
,
"
"
,
"
"
,
""
)
string
=
string
.
gsub
/\u2028/
,
''
string
end
...
...
This diff is collapsed.
Click to expand it.
app/views/active_storage/blobs/jekyll.html.erb
+
9
−
7
View file @
c9ab431a
...
...
@@ -2,10 +2,12 @@
width
,
height
=
@blob
.
metadata
.
values_at
(
'width'
,
'height'
)
ratio
=
width
.
present?
&&
height
.
present?
?
(
width
.
to_f
/
height
.
to_f
)
:
nil
%>
name:
<%=
@blob
.
filename
.
to_s
%>
size:
<%=
@blob
.
byte_size
%>
<%
if
width
.
present?
%>
width:
<%=
width
%><%
end
%>
<%
if
height
.
present?
%>
height:
<%=
height
%><%
end
%>
<%
if
ratio
.
present?
%>
ratio:
<%=
ratio
%><%
end
%>
<%# TODO: Replace with the media endpoint when it's ready %>
url:
<%=
@blob
.
url
%>
<%# TODO: Replace @blob.url with the media endpoint when it's ready %>
<%=
{
"name"
=>
@blob
.
filename
.
to_s
,
"size"
=>
@blob
.
byte_size
,
"width"
=>
width
,
"height"
=>
height
,
"ratio"
=>
ratio
,
"url"
=>
@blob
.
url
}.
compact
.
to_yaml
%>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment