解决Firefox+Violentmonkey 使用脚本不能打包下载的问题#276
Merged
ChinaGodMan merged 4 commits intoChinaGodMan:mainfrom Apr 2, 2026
Merged
Conversation
1.arrayBuffer() 比 blob() 更可靠:在跨域和 CSP 受限环境下,ArrayBuffer 的获取策略更严格但更稳定,JSZip 可以完全读取二进制数据。 2.Uint8Array 是 JSZip 原生支持的类型:避免浏览器对 blob 的“不透明”包装。
Collaborator
|
@Metric640 你好,人民的勤务员将尽快审查合并此次请求!🚀 [自动回复,请勿跟帖] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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