From c32ad089bbca149926e00772c20517992843f947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=A2=E6=AF=94=E5=B0=8F=E9=87=91=E5=88=9A?= <2890636389@qq.com> Date: Mon, 29 Jan 2024 15:15:37 +0800 Subject: [PATCH] Guard `quality` option when using types that do not have quality setting (#118) --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index d2f9c5f..5d76b92 100644 --- a/index.js +++ b/index.js @@ -216,7 +216,7 @@ const internalCaptureWebsiteCore = async (input, options, page, browser) => { screenshotOptions.type = options.type; } - if (options.quality) { + if (typeof options.quality === 'number' && options.type && options.type !== 'png') { screenshotOptions.quality = options.quality * 100; }