Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
mastodon
Commits
d06a724b
Commit
d06a724b
authored
6 years ago
by
ThibG
Committed by
Eugen Rochko
6 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Check that twitter:player is valid before using it (#9254)
Fixes #9251
parent
f73b7e77
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/services/fetch_link_card_service.rb
+5
-4
app/services/fetch_link_card_service.rb
with
5 additions
and
4 deletions
+5
-4
app/services/fetch_link_card_service.rb
+
5
-
4
View file @
d06a724b
...
...
@@ -136,14 +136,15 @@ class FetchLinkCardService < BaseService
detector
=
CharlockHolmes
::
EncodingDetector
.
new
detector
.
strip_tags
=
true
guess
=
detector
.
detect
(
@html
,
@html_charset
)
page
=
Nokogiri
::
HTML
(
@html
,
nil
,
guess
&
.
fetch
(
:encoding
,
nil
))
guess
=
detector
.
detect
(
@html
,
@html_charset
)
page
=
Nokogiri
::
HTML
(
@html
,
nil
,
guess
&
.
fetch
(
:encoding
,
nil
))
player_url
=
meta_property
(
page
,
'twitter:player'
)
if
meta_property
(
page
,
'twitter:
player
'
)
if
player_url
&&
!
bad_url?
(
Addressable
::
URI
.
parse
(
player
_url
)
)
@card
.
type
=
:video
@card
.
width
=
meta_property
(
page
,
'twitter:player:width'
)
||
0
@card
.
height
=
meta_property
(
page
,
'twitter:player:height'
)
||
0
@card
.
html
=
content_tag
(
:iframe
,
nil
,
src:
meta_property
(
page
,
'twitter:
player
'
)
,
@card
.
html
=
content_tag
(
:iframe
,
nil
,
src:
player
_url
,
width:
@card
.
width
,
height:
@card
.
height
,
allowtransparency:
'true'
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets