mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
fix(plugin-md-power): catch image-size error (#634)
This commit is contained in:
parent
309be687b4
commit
f7ec566ae5
@ -255,8 +255,11 @@ export async function resolveImageSize(app: App, url: string, remote = false): P
|
||||
if (url[0] === '/') {
|
||||
const filepath = app.dir.public(url.slice(1))
|
||||
if (fs.existsSync(filepath)) {
|
||||
const { width, height } = imageSize(fs.readFileSync(filepath))
|
||||
return { width: width!, height: height! }
|
||||
try {
|
||||
const { width, height } = imageSize(fs.readFileSync(filepath))
|
||||
return { width: width!, height: height! }
|
||||
}
|
||||
catch {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user