Skip to content

fix:兼容 Notion 的旧 AWS 链接格式与新的 attachment 链接,避免 embed 链接被错误处理 #3353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

LooseLi
Copy link
Contributor

@LooseLi LooseLi commented Apr 15, 2025

尽量按此模板PR内容,或粘贴相关的ISSUE链接。

Fixes #3352

已知问题

notion 中通过 embed 嵌入的文件链接不会以 attachment 开头,原有代码会错误地对所有文件类型进行签名,导致嵌入链接失效。

解决方案

优化 Notion 媒体资源链接处理逻辑,同时支持新旧两种格式:

  • 新格式:以 'attachment' 开头的内部链接
  • 旧格式:包含 'amazonaws.com' 的 AWS 托管链接

改动收益

  1. 通过 upload 上传和 embed 嵌入链接的新文件均能正常加载
  2. 若文件是包含 'amazonaws.com' 的 AWS 托管链接,也能正确加载

具体改动

/lib/notion/getPostBlocks.js

测试确认

  • 本地开发环境测试通过
  • 生产环境构建测试通过
  • 版本号正确显示
  • 环境变量配置正常工作

Copy link

vercel bot commented Apr 15, 2025

@LooseLi is attempting to deploy a commit to the tangly1024's projects Team on Vercel.

A member of the Team first needs to authorize it.

@LooseLi LooseLi changed the title fix:仅对以 attachment 开头的上传文件进行签名,避免 embed 链接被错误处理 fix:兼容 Notion 的旧 AWS 链接格式与新的 attachment 链接,避免 embed 链接被错误处理 Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4.8.4更新后原来notion里使用直链的文件现在又播放不了了
1 participant