fix(app/metrics): markdown conversion to pdf (Cannot read properties of undefined (reading 'length')) (#1037)
This commit is contained in:
@@ -159,6 +159,7 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
|
|||||||
gemojis: q["config.gemoji"],
|
gemojis: q["config.gemoji"],
|
||||||
octicons: q["config.octicon"],
|
octicons: q["config.octicon"],
|
||||||
rest,
|
rest,
|
||||||
|
errors,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return {rendered, mime: "text/html", errors}
|
return {rendered, mime: "text/html", errors}
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ export async function imgb64(image, {width, height, fallback = true} = {}) {
|
|||||||
/**SVG utils */
|
/**SVG utils */
|
||||||
export const svg = {
|
export const svg = {
|
||||||
/**Render as pdf */
|
/**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
|
//Instantiate browser if needed
|
||||||
if (!svg.resize.browser) {
|
if (!svg.resize.browser) {
|
||||||
svg.resize.browser = await puppeteer.launch()
|
svg.resize.browser = await puppeteer.launch()
|
||||||
@@ -374,7 +374,7 @@ export const svg = {
|
|||||||
//Result
|
//Result
|
||||||
await page.close()
|
await page.close()
|
||||||
console.debug("metrics/svg/pdf > rendering complete")
|
console.debug("metrics/svg/pdf > rendering complete")
|
||||||
return {rendered, mime: "application/pdf"}
|
return {rendered, mime: "application/pdf", errors}
|
||||||
},
|
},
|
||||||
/**Render and resize svg */
|
/**Render and resize svg */
|
||||||
async resize(rendered, {paddings, convert, scripts = []}) {
|
async resize(rendered, {paddings, convert, scripts = []}) {
|
||||||
|
|||||||
Reference in New Issue
Block a user