Fix the image urls not loading except for uploaded files (#6424)

pull/6446/head
Bradley Hilton 9 years ago committed by Rodrigo Nascimento
parent eb066f1ece
commit 476542a418
  1. 4
      HISTORY.md
  2. 15
      packages/rocketchat-message-attachments/client/messageAttachment.coffee
  3. 4
      packages/rocketchat-message-attachments/client/messageAttachment.html

@ -1,5 +1,9 @@
# History
## NEXT
- [FIX] Images on attachments were not loading except for uploaded files.
## 0.54.0 - 2017-Mar-22
### Meteor update to 1.4.3.1

@ -61,18 +61,3 @@ Template.messageAttachment.helpers
injectIndex: (data, previousIndex, index) ->
data.index = previousIndex + '.attachments.' + index
return
safeLoadImageAttachment: (url) ->
host = ''
url = fixCordova(url)
if url.indexOf("://") > -1
host = url.split('/')[2]
else
host = url.split('/')[0]
host = host.split(':')[0]
if host != window.location.hostname
return ''
else
return url

@ -66,8 +66,8 @@
<div class="attachment-image">
{{#if loadImage}}
<figure>
<div class="inline-image" style="background-image: url('{{safeLoadImageAttachment image_url}}');">
<img src="{{safeLoadImageAttachment image_url}}" height="{{getImageHeight image_dimensions.height}}" class="gallery-item" data-title="{{title}}" data-description="{{description}}">
<div class="inline-image" style="background-image: url('{{fixCordova image_url}}');">
<img src="{{fixCordova image_url}}" height="{{getImageHeight image_dimensions.height}}" class="gallery-item" data-title="{{title}}" data-description="{{description}}">
</div>
{{#if description}}
<figcaption class="attachment-description">{{description}}</figcaption>

Loading…
Cancel
Save