diff --git a/plugins/plugin-md-power/src/node/enhance/imageSize.ts b/plugins/plugin-md-power/src/node/enhance/imageSize.ts index 5a942203..1408855c 100644 --- a/plugins/plugin-md-power/src/node/enhance/imageSize.ts +++ b/plugins/plugin-md-power/src/node/enhance/imageSize.ts @@ -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 {} } }