Fixes of bugs caused by the public endpoint.

This commit is contained in:
Tomas Bures 2018-09-29 22:07:24 +02:00
parent efbfa2b366
commit 213039c141
10 changed files with 79 additions and 52 deletions

View file

@ -51,7 +51,7 @@ class CampaignSender {
}
if (campaign.source === CampaignSource.TEMPLATE) {
this.template = templates.getByIdTx(tx, contextHelpers.getAdminContext(), this.campaign.data.sourceTemplate, false);
this.template = await templates.getByIdTx(tx, contextHelpers.getAdminContext(), this.campaign.data.sourceTemplate, false);
}
const attachments = await files.listTx(tx, contextHelpers.getAdminContext(), 'campaign', 'attachment', this.campaign.id);
@ -111,7 +111,7 @@ class CampaignSender {
if (replaceDataImgs) {
// replace data: images with embedded attachments
html = html.replace(/(<img\b[^>]* src\s*=[\s"']*)(data:[^"'>\s]+)/gi, (match, prefix, dataUri) => {
let cid = shortid.generate() + '-attachments@' + campaign.address.split('@').pop();
const cid = shortid.generate() + '-attachments@' + campaign.address.split('@').pop();
attachments.push({
path: dataUri,
cid