mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-29 23:16:51 +00:00
修复图片异常导致站点崩溃的bug
This commit is contained in:
@@ -119,10 +119,19 @@ const compressImage = (image, width, quality = 50, fmt = 'webp') => {
|
|||||||
width = siteConfig('IMAGE_COMPRESS_WIDTH')
|
width = siteConfig('IMAGE_COMPRESS_WIDTH')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将URL解析为一个对象
|
|
||||||
const urlObj = new URL(image)
|
let urlObj
|
||||||
// 获取URL参数
|
let params
|
||||||
const params = new URLSearchParams(urlObj.search)
|
try {
|
||||||
|
// 将URL解析为一个对象
|
||||||
|
urlObj = new URL(image)
|
||||||
|
// 获取URL参数
|
||||||
|
params = new URLSearchParams(urlObj.search)
|
||||||
|
} catch (err) {
|
||||||
|
// 捕获异常并打印错误的url
|
||||||
|
console.error('compressImage: Invalid URL:', image, err)
|
||||||
|
return image
|
||||||
|
}
|
||||||
|
|
||||||
// Notion图床
|
// Notion图床
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user