Skip to content

Commit

Permalink
fixes preview issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed Dec 22, 2015
1 parent bc3e204 commit ec2d054
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
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 @@ -9,7 +9,7 @@
{{#if author_link}}
<div class="attachment-author">
{{#if author_icon}}
<img src="{{author_icon}}">
<img src="{{fixCordova author_icon}}">
{{/if}}
<a href="{{fixCordova author_link}}" target="_blank">{{author_name}}</a>
</div>
Expand Down
7 changes: 7 additions & 0 deletions packages/rocketchat-oembed/client/oembedUrlWidget.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ 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 ec2d054

Please sign in to comment.