From 72ec67d7c946d0223f2800243a6ff4bd0196637e Mon Sep 17 00:00:00 2001 From: Matijs Eijkemans Date: Thu, 22 Apr 2021 20:22:49 +0200 Subject: [PATCH] Possible fix image validation --- mqtt/client.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mqtt/client.js b/mqtt/client.js index 58677ae..d23ef5d 100644 --- a/mqtt/client.js +++ b/mqtt/client.js @@ -129,7 +129,7 @@ class MqttClient { const response = await fetch(thumbnailUrl) let image = await response.buffer() - const result = validateBufferMIMEType(image, { + const result = await validateBufferMIMEType(image, { allowMimeTypes: ['image/jpeg', 'image/gif', 'image/png', 'image/svg+xml'] }) @@ -142,11 +142,11 @@ class MqttClient { const response = await fetch(thumbnailUrl) image = await response.buffer() - const result = validateBufferMIMEType(image, { + const retryResult = await validateBufferMIMEType(image, { allowMimeTypes: ['image/jpeg', 'image/gif', 'image/png', 'image/svg+xml'] }) - winston.info(`Retry - Image validation result: `, result) + winston.info(`Retry - Image validation result: `, retryResult) } const topic = HaDiscovery.baseTopicForCapability(NotificationType.THUMBNAIL, deviceSN)