Skip to content

解决Firefox+Violentmonkey 使用脚本不能打包下载的问题#276

Merged
ChinaGodMan merged 4 commits intoChinaGodMan:mainfrom
Metric640:main
Apr 2, 2026
Merged

解决Firefox+Violentmonkey 使用脚本不能打包下载的问题#276
ChinaGodMan merged 4 commits intoChinaGodMan:mainfrom
Metric640:main

Conversation

@Metric640
Copy link
Copy Markdown
Contributor

1.arrayBuffer() 比 blob() 更可靠:在跨域和 CSP 受限环境下,ArrayBuffer 的获取策略更严格但更稳定,JSZip 可以完全读取二进制数据。 2.Uint8Array 是 JSZip 原生支持的类型:避免浏览器对 blob 的“不透明”包装。

变更内容

当从跨域资源(x.com 的图片)获取 blob 时,返回的 blob 可能被标记为“不透明”(opaque)或受到 CORS 限制,导致 JSZip 无法读取其内部数据。
修复方案:将 blob 转换为 ArrayBuffer
JSZip 官方推荐使用 ArrayBuffer 或 Uint8Array 添加二进制数据,这能绕过 Firefox 对 blob 类型的限制。

相关问题

#273

1.arrayBuffer() 比 blob() 更可靠:在跨域和 CSP 受限环境下,ArrayBuffer 的获取策略更严格但更稳定,JSZip 可以完全读取二进制数据。
2.Uint8Array 是 JSZip 原生支持的类型:避免浏览器对 blob 的“不透明”包装。
@labels-and-badges labels-and-badges Bot added NO JIRA This PR does not have a Jira Ticket PR:size/M Denotes a Pull Request that changes 30-99 lines. release This PR is a release labels Apr 2, 2026
@ChinaGodBot
Copy link
Copy Markdown
Collaborator

@Metric640 你好,人民的勤务员将尽快审查合并此次请求!🚀 [自动回复,请勿跟帖]

@ChinaGodBot ChinaGodBot requested a review from ChinaGodMan April 2, 2026 07:04
Copy link
Copy Markdown
Owner

@ChinaGodMan ChinaGodMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

@labels-and-badges labels-and-badges Bot added the PR:APPROVED Review is approved label Apr 2, 2026
@ChinaGodMan ChinaGodMan merged commit 02c8ee4 into ChinaGodMan:main Apr 2, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NO JIRA This PR does not have a Jira Ticket PR:APPROVED Review is approved PR:size/M Denotes a Pull Request that changes 30-99 lines. release This PR is a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants