Skip to content

Commit

Permalink
Possible fix image validation
Browse files Browse the repository at this point in the history
  • Loading branch information
matijse committed Apr 22, 2021
1 parent 40fb754 commit 72ec67d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mqtt/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
})

Expand All @@ -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)
Expand Down

0 comments on commit 72ec67d

Please sign in to comment.