Skip to content

Commit

Permalink
fix(email-plugin): Fix broken images in order-confirmation mock emails
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Mar 19, 2021
1 parent 9ae47f1 commit 82eefde
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions packages/email-plugin/src/dev-mailbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ export class DevMailbox {
const content = await this.getEmail(outputPath, fileName);
res.send(content);
});
server.get('/placeholder-image', async (req, res) => {
const img = Buffer.from(
'/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCADgAO4DASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD7VooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACszXNeg0SENJ88rfdjB5NafTrXlPiHUW1PVZpScqDtX2AoGX7jxxqM0m5GWFf7qj/ABqL/hMtU/57/wDjorDooGbn/CZap/z3/wDHRR/wmWqf89//AB0Vh0UAbn/CZap/z3/8dFWLPx1fwSfvgs6Z5BGD+GK5uigD1vSdWg1i1E0J/wB5e6mrtea+DdQNlrCIWxHN8hHbPavSqBBRRRQIKKKKACiiigAooooAKKKKACiiigAooooAKKKKACqepatbaTD5lxIE9F6k/hU17dpY2ss8n3I1ya8p1TVJtWu3nlPU8LnhR6UDOquPiEqswhttwzwWNQ/8LDm/59U/M1x9FAzq7rx9PcW8ka26IXUruyeM965UnJyetJRQAUUUUDCiiigAooooAcjmNwykhgcgiutX4hTKoBtkYgdcmuQooEdh/wALDm/59U/M1Ys/iDG8gFzB5a/3k5rh6KAPYbG/g1GES28gkQ+nb61PXleg61Lo14rg5iY4dM8EV6lFIJY0cdGAIoEOooooEFFFFABRRRQAUUUUAFFFFABRRRQBgeOJDHoLY/idVP615tXo3jz/AJAP/bVf615zQUgooooGFFFLQAlWLXT7m8YCGF5M91HH510/hvwd9oVLq9BCdVi9R712sFvFaxhIo1jUdlFArnnkPgfUpFyypGfRm/wptx4J1KFcrGsvGflYf1r0nIHU0ZoFc8duLWa1bbNE8Z/2lIqGvYbqxgvoyk8SyL7iuD8SeE30sG4t8yW+eR3SgZzVFFFAwooooAK9W8NSGbQrN26lP6mvKa9T8K/8i/Zf7n9TQJmrRRRQ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j+tebV7BqFmmoWcsD9HGK8o1Cxl026kgmXDKcZ7H3FBSK1FFFAwooooAKuWerXmnsDBcPHjoucj8jVOigDpY/HmoR7dyxyY67h1ps3jrUZFYL5cZPQqOn51zlFAizdajc3rEzzvJnsTx+VVqKKBhRRRQAUUUUAFeq+GY2i0GzVhhgnT8TXnWh6TJq9/HCo+TOXbsBXqsMSwQpGowqjAoEx9FFFBIUUUUAFFFFABRRRQAUUUUAFFFFABVHVtFttYhCTplh91x1FXqKAOIuPh5Lu/cXSbf+mgP9Ki/4V5d/wDP1D+R/wAK7yigdzg/+FeXf/P1D+R/wo/4V5d/8/UP5H/Cu8ooC5wf/CvLv/n6h/I/4Uf8K8u/+fqH8j/hXeUUBc4P/hXl3/z9Q/kf8KP+FeXf/P1D+R/wrvKKAucH/wAK8u/+fqH8j/hR/wAK8u/+fqH8j/hXeUUBc4P/AIV5d/8AP1D+R/wo/wCFeXf/AD9Q/kf8K7yigLnB/wDCvLv/AJ+ofyP+FWLX4ekMDc3KkZ6Rg12lFAXKmm6VbaVD5dvGEB6nuat0UUCCiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKAP/9k=',
'base64',
);

res.writeHead(200, {
'Content-Type': 'image/png',
'Content-Length': img.length,
});
res.end(img);
});

return server;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/email-plugin/src/mock-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const mockOrderStateTransitionEvent = new OrderStateTransitionEvent(
new OrderLine({
id: '5',
featuredAsset: {
preview: 'http://localhost:3000/assets/alexandru-acea-686569-unsplash__preview.jpg',
preview: '/mailbox/placeholder-image',
},
productVariant: new ProductVariant({
id: '2',
Expand All @@ -63,7 +63,7 @@ export const mockOrderStateTransitionEvent = new OrderStateTransitionEvent(
new OrderLine({
id: '6',
featuredAsset: {
preview: 'http://localhost:3000/assets/vincent-botta-736919-unsplash__preview.jpg',
preview: '/mailbox/placeholder-image',
},
productVariant: new ProductVariant({
id: '4',
Expand Down

0 comments on commit 82eefde

Please sign in to comment.