Skip to content

Commit

Permalink
fix(core): use pathToFileURL instead of string concat
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Nov 19, 2023
1 parent 9067bdb commit 5a0b007
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Context, h, hyphenate, Schema, Service } from 'koishi'
import { SVG, SVGOptions } from './svg'
import Canvas from './canvas'
import { resolve } from 'path'
import { pathToFileURL } from 'url'

export * from './svg'
export * from 'puppeteer-core'

declare module 'koishi' {
interface Context {
Expand Down Expand Up @@ -87,7 +87,7 @@ class Puppeteer extends Service {
if (attrs.src) {
await page.goto(attrs.src)
} else {
await page.goto('file:///' + resolve(__dirname, '../index.html'))
await page.goto(pathToFileURL(resolve(__dirname, '../index.html')).href)
const bodyStyle = typeof attrs.style === 'object'
? transformStyle({ display: 'inline-block' }, attrs.style)
: ['display: inline-block', attrs.style].filter(Boolean).join('; ')
Expand Down

0 comments on commit 5a0b007

Please sign in to comment.