diff --git a/client/components/cards/attachments.jade b/client/components/cards/attachments.jade index 88276c76f..3a2949ff8 100644 --- a/client/components/cards/attachments.jade +++ b/client/components/cards/attachments.jade @@ -12,7 +12,7 @@ template(name="previewClipboardImagePopup") button.primary.js-upload-pasted-image {{_ 'upload'}} template(name="previewAttachedImagePopup") - img.preview-large-image.js-large-image-clicked(src="{{url}}") + img.preview-large-image.js-large-image-clicked(src="{{link}}") template(name="attachmentDeletePopup") p {{_ "attachment-delete-pop"}} @@ -22,22 +22,22 @@ template(name="attachmentsGalery") .attachments-galery each attachments .attachment-item - a.attachment-thumbnail.swipebox(href="{{url}}" title="{{name}}") + a.attachment-thumbnail.swipebox(href="{{link}}" title="{{name}}") if isUploaded if isImage - img.attachment-thumbnail-img(src="{{url}}") + img.attachment-thumbnail-img(src="{{link}}") else if($eq extension 'mp3') video(width="100%" height="100%" controls="true") - source(src="{{url}}" type="audio/mpeg") + source(src="{{link}}" type="audio/mpeg") else if($eq extension 'ogg') video(width="100%" height="100%" controls="true") - source(src="{{url}}" type="video/ogg") + source(src="{{link}}" type="video/ogg") else if($eq extension 'webm') video(width="100%" height="100%" controls="true") - source(src="{{url}}" type="video/webm") + source(src="{{link}}" type="video/webm") else if($eq extension 'mp4') video(width="100%" height="100%" controls="true") - source(src="{{url}}" type="video/mp4") + source(src="{{link}}" type="video/mp4") else span.attachment-thumbnail-ext= extension else @@ -46,7 +46,7 @@ template(name="attachmentsGalery") = name span.file-size ({{fileSize size}} KB) span.attachment-details-actions - a.js-download(href="{{url download=true}}") + a.js-download(href="{{link}}?download=true") i.fa.fa-download | {{_ 'download'}} if currentUser.isBoardMember diff --git a/models/cards.js b/models/cards.js index f1c49c4af..35761587e 100644 --- a/models/cards.js +++ b/models/cards.js @@ -740,12 +740,12 @@ Cards.helpers({ return Attachments.find( { 'meta.cardId': this.linkedId }, { sort: { uploadedAt: -1 } }, - ); + ).each(); } else { return Attachments.find( { 'meta.cardId': this._id }, { sort: { uploadedAt: -1 } }, - ); + ).each(); } }, @@ -754,7 +754,7 @@ Cards.helpers({ const cover = Attachments.findOne(this.coverId); // if we return a cover before it is fully stored, we will get errors when we try to display it // todo XXX we could return a default "upload pending" image in the meantime? - return cover && cover.path && cover; + return cover && cover.link() && cover; }, checklists() {