@jsreport/jsreport-assets
Advanced tools
Comparing version 3.4.4 to 3.5.0
@@ -52,2 +52,10 @@ const fs = require('fs/promises') | ||
} | ||
if (typeof name !== 'string') { | ||
throw reporter.createError('Asset path must be a string', { | ||
statusCode: 400, | ||
weak: true | ||
}) | ||
} | ||
const assetNameIsPath = name.indexOf('/') !== -1 | ||
@@ -54,0 +62,0 @@ const pathParts = name.split('/').filter((p) => p) |
@@ -32,3 +32,5 @@ const util = require('util') | ||
if (paramRaw.split('=').length !== 2) { | ||
throw new Error('Wrong asset param specification, should be {#asset name @encoding=base64}') | ||
throw reporter.createError('Wrong asset param specification, should be {#asset name @encoding=base64}', { | ||
statusCode: 400 | ||
}) | ||
} | ||
@@ -40,11 +42,17 @@ | ||
if (paramName !== 'encoding') { | ||
throw new Error('Unsupported param ' + paramName) | ||
throw reporter.createError('Unsupported param ' + paramName, { | ||
statusCode: 400 | ||
}) | ||
} | ||
if (paramValue !== 'base64' && paramValue !== 'utf8' && paramValue !== 'string' && paramValue !== 'link' && paramValue !== 'dataURI') { | ||
throw new Error('Unsupported asset encoding param value ' + paramValue + ', supported values are base64, utf8, link, dataURI and string') | ||
throw reporter.createError('Unsupported asset encoding param value ' + paramValue + ', supported values are base64, utf8, link, dataURI and string', { | ||
statusCode: 400 | ||
}) | ||
} | ||
if (paramValue === 'dataURI' && !isImage(assetName) && !isFont(assetName)) { | ||
throw new Error('Asset encoded as dataURI needs to have file extension jpeg|jpg|gif|png|svg|woff|tff|otf|woff2|eot') | ||
throw reporter.createError('Asset encoded as dataURI needs to have file extension jpeg|jpg|gif|png|svg|woff|tff|otf|woff2|eot', { | ||
statusCode: 400 | ||
}) | ||
} | ||
@@ -51,0 +59,0 @@ |
{ | ||
"name": "@jsreport/jsreport-assets", | ||
"version": "3.4.4", | ||
"version": "3.5.0", | ||
"description": "jsreport extension embedding static assets like fonts or helpers into the templates", | ||
@@ -39,3 +39,3 @@ "keywords": [ | ||
"mime": "2.4.4", | ||
"minimatch": "3.0.4", | ||
"minimatch": "5.1.0", | ||
"react-copy-to-clipboard": "5.0.2", | ||
@@ -45,4 +45,4 @@ "strip-bom-buf": "2.0.0" | ||
"devDependencies": { | ||
"@jsreport/jsreport-core": "3.8.0", | ||
"@jsreport/jsreport-express": "3.4.2", | ||
"@jsreport/jsreport-core": "3.9.0", | ||
"@jsreport/jsreport-express": "3.5.0", | ||
"@jsreport/jsreport-handlebars": "3.2.1", | ||
@@ -53,3 +53,3 @@ "@jsreport/jsreport-jsrender": "3.0.0", | ||
"binary-extensions": "1.12.0", | ||
"mocha": "8.2.1", | ||
"mocha": "10.1.0", | ||
"moment": "2.29.4", | ||
@@ -56,0 +56,0 @@ "should": "13.2.3", |
@@ -11,2 +11,7 @@ # @jsreport/jsreport-assets | ||
### 3.5.0 | ||
- errors from asset logic should be weak | ||
- validate that passed asset path is string | ||
### 3.4.4 | ||
@@ -13,0 +18,0 @@ |
228294
3548
61
+ Addedminimatch@5.1.0(transitive)
- Removedminimatch@3.0.45.1.6(transitive)
Updatedminimatch@5.1.0