Skip to content

Commit

Permalink
proper fix preview images
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego authored and engelgabriel committed Dec 22, 2015
1 parent ec2d054 commit a381bf5
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
Template.messageAttachment.helpers
fixCordova: (url) ->
slash = url.lastIndexOf('/') + 1

fileName = url.substr slash
filePath = url.substr 0, slash

url = filePath + encodeURIComponent fileName

if Meteor.isCordova and url?[0] is '/'
return Meteor.absoluteUrl().replace(/\/$/, '') + url
return url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<div class="attachment-image">
{{#if showImage}}
<a href="{{fixCordova image_url}}" class="swipebox" target="_blank">
<div class="inline-image" style="background-image: url({{fixCordova image_url}});">
<div class="inline-image" style="background-image: url('{{fixCordova image_url}}');">
<img src="{{fixCordova image_url}}" height="{{getImageHeight image_dimensions.height}}">
</div>
</a>
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-oembed/client/oembedImageWidget.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{#if parsedUrl}}
<div>
<a href="{{url}}" class="swipebox" target="_blank">
<div class="inline-image" style="background-image: url({{url}});">
<div class="inline-image" style="background-image: url('{{url}}');">
<img src="{{url}}" height="200">
</div>
</a>
Expand Down
7 changes: 0 additions & 7 deletions packages/rocketchat-oembed/client/oembedUrlWidget.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ Template.oembedUrlWidget.helpers

decodedOgImage = @meta.ogImage?.replace?(/&amp;/g, '&')

slash = decodedOgImage.lastIndexOf('/') + 1

fileName = decodedOgImage.substr slash
filePath = decodedOgImage.substr 0, slash

decodedOgImage = filePath + encodeURIComponent fileName

return decodedOgImage or this.meta.twitterImage

show: ->
Expand Down

0 comments on commit a381bf5

Please sign in to comment.