Node.js based forum software built for the modern web
fix: use sharp to convert svg to png, closes #13534
Barış Soner Uşaklıb74c789849eb
diff --git a/install/package.json b/install/package.jsonindex 4033fe1a27..dbb07c0c20 100644--- a/install/package.json+++ b/install/package.json@@ -35,7 +35,6 @@"@isaacs/ttlcache": "1.4.1","@nodebb/spider-detector": "2.0.3","@popperjs/core": "2.11.8",- "@resvg/resvg-js": "2.6.2","@textcomplete/contenteditable": "0.1.13","@textcomplete/core": "0.1.13","@textcomplete/textarea": "0.1.13",diff --git a/src/categories/icon.js b/src/categories/icon.jsindex 93f5614630..7aa94ab802 100644--- a/src/categories/icon.js+++ b/src/categories/icon.js@@ -5,7 +5,7 @@ const fs = require('fs/promises');const nconf = require('nconf');const winston = require('winston');const { default: satori } = require('satori');-const { Resvg } = require('@resvg/resvg-js');+const sharp = require('sharp');const utils = require('../utils');@@ -96,9 +96,9 @@ Icons.regenerate = async (cid) => {await fs.writeFile(path.resolve(nconf.get('upload_path'), 'category', `category-${cid}-icon.svg`), svg);// Generate and save PNG- const resvg = new Resvg(Buffer.from(svg));- const pngData = resvg.render();- const pngBuffer = pngData.asPng();+ const pngBuffer = await sharp(Buffer.from(svg))+ .png()+ .toBuffer();await fs.writeFile(path.resolve(nconf.get('upload_path'), 'category', `category-${cid}-icon.png`), pngBuffer);