From 7123f68737cc9a759f7951dba4cd30db0b9fbe8b Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Wed, 15 Apr 2020 19:15:21 +0200 Subject: [PATCH] Allow to create the media.update webhook + fix default width and height Signed-off-by: Alexandre Bodin --- packages/strapi-admin/controllers/Webhooks.js | 7 ++----- .../strapi-plugin-upload/services/image-manipulation.js | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/strapi-admin/controllers/Webhooks.js b/packages/strapi-admin/controllers/Webhooks.js index 785baa039e..a307e3c4f0 100644 --- a/packages/strapi-admin/controllers/Webhooks.js +++ b/packages/strapi-admin/controllers/Webhooks.js @@ -8,6 +8,7 @@ const ALLOWED_EVENTS = [ 'entry.update', 'entry.delete', 'media.create', + 'media.update', 'media.delete', ]; @@ -165,11 +166,7 @@ module.exports = { const webhook = await strapi.webhookStore.findWebhook(id); - const response = await strapi.webhookRunner.run( - webhook, - 'trigger-test', - {} - ); + const response = await strapi.webhookRunner.run(webhook, 'trigger-test', {}); ctx.body = { data: response }; }, diff --git a/packages/strapi-plugin-upload/services/image-manipulation.js b/packages/strapi-plugin-upload/services/image-manipulation.js index 1a6bdbb5d5..9a32ec8779 100644 --- a/packages/strapi-plugin-upload/services/image-manipulation.js +++ b/packages/strapi-plugin-upload/services/image-manipulation.js @@ -13,7 +13,7 @@ const getMetadatas = buffer => const getDimensions = buffer => getMetadatas(buffer) - .then(({ width, height }) => ({ width, height })) + .then(({ width = null, height = null }) => ({ width, height })) .catch(() => ({})); // ignore errors const THUMBNAIL_RESIZE_OPTIONS = {