diff --git a/package.json b/package.json index 5046f5ac..64b59324 100644 --- a/package.json +++ b/package.json @@ -219,6 +219,7 @@ "sqlite3": "5.1.7", "ssr-for-bots": "1.0.1-c", "strict-password-generator": "1.1.2", + "svg2img": "^1.0.0-beta.2", "swagger-client": "3.29.2", "swagger-ui-dist": "5.17.14", "tabulator-tables": "6.2.5", diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index 90fb91d8..43eeb7e7 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -1066,9 +1066,24 @@ export class KBService implements IGBKBService { logo = logo.startsWith('https') ? logo : urlJoin(baseUrl, logo); const logoBinary = await page.goto(logo); - const buffer = await logoBinary.buffer(); + let buffer = await logoBinary.buffer(); const logoFilename = path.basename(logo); + // Replace sharp with jimp + if (buffer.toString().includes(' { + svg2img(buffer, {width: 48, height: 48}, (error: any, buffer: Buffer) => { + if (error) { + reject(error); + } else { + resolve(buffer); + } + }); + }); + } + // Replace sharp with jimp const image = await Jimp.read(buffer); await image.scaleToFit({w:48, h:48});