fix: 兼容旧的 AWS 链接格式以确保旧文件正常加载

This commit is contained in:
LooseLi
2025-04-16 09:46:29 +08:00
parent a67e9086a0
commit 91493bda00

View File

@@ -139,12 +139,10 @@ function convertNotionBlocksToPost(id, blockMap, slice) {
// 如果是文件或嵌入式PDF需要重新加密签名
if (
(b?.value?.type === 'file' ||
b?.value?.type === 'pdf' ||
b?.value?.type === 'video' ||
b?.value?.type === 'audio') &&
['file', 'pdf', 'video', 'audio'].includes(b?.value?.type) &&
b?.value?.properties?.source?.[0][0] &&
b?.value?.properties?.source?.[0][0].indexOf('attachment') === 0
(b?.value?.properties?.source?.[0][0].indexOf('attachment') === 0 ||
b?.value?.properties?.source?.[0][0].indexOf('amazonaws.com') > 0)
) {
const oldUrl = b?.value?.properties?.source?.[0][0]
const newUrl = `https://notion.so/signed/${encodeURIComponent(oldUrl)}?table=block&id=${b?.value?.id}`