From 94bf192f1221bd91c14638cd92f19e6babe041d4 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Wed, 16 Sep 2020 22:57:06 -0500 Subject: [PATCH] fixup! fix: cover image - works now --- client/components/cards/minicard.jade | 2 +- models/cards.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/components/cards/minicard.jade b/client/components/cards/minicard.jade index 0d41377a8..e382e4a1e 100644 --- a/client/components/cards/minicard.jade +++ b/client/components/cards/minicard.jade @@ -7,7 +7,7 @@ template(name="minicard") .handle .fa.fa-arrows if cover - .minicard-cover(style="background-image: url('{{cover.link}}');") + .minicard-cover(style="background-image: url('{{cover.link 'original' '/'}}');") if labels .minicard-labels(class="{{#if hiddenMinicardLabelText}}minicard-labels-no-text{{/if}}") each labels diff --git a/models/cards.js b/models/cards.js index 7b282fe9c..f1c49c4af 100644 --- a/models/cards.js +++ b/models/cards.js @@ -751,7 +751,10 @@ Cards.helpers({ cover() { if (!this.coverId) return false; - return Attachments.findOne(this.coverId); + 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; }, checklists() {