fix(app/metrics): markdown conversion to pdf (Cannot read properties of undefined (reading 'length')) (#1037)

This commit is contained in:
Simon Lecoq
2022-05-10 00:51:05 +02:00
committed by GitHub
parent 0266ad7250
commit 9c677bf7cd
2 changed files with 3 additions and 2 deletions

View File

@@ -159,6 +159,7 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
gemojis: q["config.gemoji"],
octicons: q["config.octicon"],
rest,
errors,
})
}
return {rendered, mime: "text/html", errors}

View File

@@ -341,7 +341,7 @@ export async function imgb64(image, {width, height, fallback = true} = {}) {
/**SVG utils */
export const svg = {
/**Render as pdf */
async pdf(rendered, {paddings = "", style = "", twemojis = false, gemojis = false, octicons = false, rest = null} = {}) {
async pdf(rendered, {paddings = "", style = "", twemojis = false, gemojis = false, octicons = false, rest = null, errors = []} = {}) {
//Instantiate browser if needed
if (!svg.resize.browser) {
svg.resize.browser = await puppeteer.launch()
@@ -374,7 +374,7 @@ export const svg = {
//Result
await page.close()
console.debug("metrics/svg/pdf > rendering complete")
return {rendered, mime: "application/pdf"}
return {rendered, mime: "application/pdf", errors}
},
/**Render and resize svg */
async resize(rendered, {paddings, convert, scripts = []}) {