message: set timeout for rendering pdf files and scaling images
diff: @@ -53,16 +53,20 @@ export class GraphicsPreview {
  async renderGraphics(filePath: string, opts: { height: number, width: number, pageNumber?: number }): Promise<string | undefined> {
  if (/\.pdf$/i.exec(filePath)) {
  - const svg0 = await this.pdfRenderer.renderToSVG(
  + const promise = this.pdfRenderer.renderToSVG(
  filePath,
  { height: opts.height, width: opts.width, pageNumber: opts.pageNumber || 1 }
  )
  + promise.timeout(3000)
  + const svg0 = await promise
  const svg = this.setBackgroundColor(svg0)
  const dataUrl = svgToDataUrl(svg)
  return dataUrl
  }
  if (/\.(bmp|jpg|jpeg|gif|png)$/i.exec(filePath)) {
  - const dataUrl = await this.graphicsScaler.scale(filePath, opts)
  + const promise = this.graphicsScaler.scale(filePath, opts)
  + promise.timeout(3000)
  + const dataUrl = await promise
  return dataUrl
  }
  return undefined
  