docx-templates
Advanced tools
Comparing version 4.5.1 to 4.5.2
@@ -0,1 +1,4 @@ | ||
## 4.5.2 (2020-11-13) | ||
* Corrected check for valid image data. ArrayBuffers are now also valid image data containers, as the type definitions suggest (issue [#166](https://github.com/guigrpa/docx-templates/issues/166)). | ||
## 4.5.1 (2020-10-24) | ||
@@ -2,0 +5,0 @@ * Enhancement: extensive validation of `IMAGE` command parameters before execution to prevent silent failures caused by user error, particularly in plain javascript and untyped settings. Related to issue [#158](https://github.com/guigrpa/docx-templates/issues/158). |
@@ -703,4 +703,6 @@ "use strict"; | ||
function validateImage(img) { | ||
if (!(img.data instanceof Buffer || typeof img.data === 'string')) { | ||
throw new Error('image .data property needs to be provided as an ArrayBuffer-equivalent or as a base64-encoded string'); | ||
if (!(img.data instanceof Buffer || | ||
img.data instanceof ArrayBuffer || | ||
typeof img.data === 'string')) { | ||
throw new Error('image .data property needs to be provided as Buffer, ArrayBuffer, or as a base64-encoded string'); | ||
} | ||
@@ -707,0 +709,0 @@ if (!types_1.ImageExtensions.includes(img.extension)) { |
@@ -153,3 +153,3 @@ /// <reference types="node" /> | ||
extension: ImageExtension; | ||
data: ArrayBuffer | string; | ||
data: Buffer | ArrayBuffer | string; | ||
}; | ||
@@ -156,0 +156,0 @@ export declare type Links = { |
{ | ||
"name": "docx-templates", | ||
"version": "4.5.1", | ||
"version": "4.5.2", | ||
"description": "Template-based docx report creation", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
147152
2496