Skip to content

Commit

Permalink
remove extended entities media display urls
Browse files Browse the repository at this point in the history
  • Loading branch information
mannynotfound committed Feb 2, 2018
1 parent bb88431 commit a6141dd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/Tweet/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import twitterText from 'twitter-text'

class Text extends React.Component {
render () {
let {data} = this.props, {text, entities} = data
let {data} = this.props
let {text, entities, extended_entities} = data

// remove any embedded media links
if (entities && entities.media) {
Expand Down Expand Up @@ -34,6 +35,13 @@ class Text extends React.Component {
// browsers add http which causes isomorphic rendering probs
text = text.replace(/src="\/\/twemoji/g, 'src="http://twemoji')

// remove any extended entities links
if (extended_entities && extended_entities.media) {
extended_entities.media.forEach(e => {
text = text.replace(e.display_url, '')
})
}


const tweetProps = {
'className': 'tweet-text',
Expand Down

0 comments on commit a6141dd

Please sign in to comment.