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] === '/') {
|
if (url[0] === '/') {
|
||||||
const filepath = app.dir.public(url.slice(1))
|
const filepath = app.dir.public(url.slice(1))
|
||||||
if (fs.existsSync(filepath)) {
|
if (fs.existsSync(filepath)) {
|
||||||
const { width, height } = imageSize(fs.readFileSync(filepath))
|
try {
|
||||||
return { width: width!, height: height! }
|
const { width, height } = imageSize(fs.readFileSync(filepath))
|
||||||
|
return { width: width!, height: height! }
|
||||||
|
}
|
||||||
|
catch {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user