Skip to content

Commit 280bb79

Browse files
committed
Notion新图床兼容
1 parent 1c2013d commit 280bb79

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/notion/mapImage.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,21 @@ const mapImgUrl = (img, block, type = 'block', needCompress = true) => {
2323
ret = img
2424
}
2525

26-
// Notion 图床转换为永久地址
2726
const hasConverted =
28-
ret.indexOf('https://www.notion.so/image') === 0 ||
29-
ret.includes('notion.site/images/page-cover/')
27+
ret.indexOf('https://www.notion.so/image') === 0 ||
28+
ret.includes('notion.site/images/page-cover/')
29+
3030
// 需要转化的URL ; 识别aws图床地址,或者bookmark类型的外链图片
31+
// Notion新图床资源 格式为 attachment:${id}:${name}
3132
const needConvert =
3233
!hasConverted &&
3334
(block.type === 'bookmark' ||
3435
ret.includes('secure.notion-static.com') ||
35-
ret.includes('prod-files-secure'))
36+
ret.includes('prod-files-secure')) ||
37+
ret.indexOf('attachment')===0
38+
3639

37-
// 使用Notion图传
40+
// Notion旧图床
3841
if (needConvert) {
3942
ret =
4043
BLOG.NOTION_HOST +

0 commit comments

Comments
 (0)