Repository navigation
fix(desktop): save page downloads through the macOS shell - #277
Open
smarty-kiki wants to merge 1 commit into
Open
smarty-kiki wants to merge 1 commit into
smarty-kiki wants to merge 1 commit into
Conversation
打包态 macOS 壳把界面跑在 WKWebView 里,而本机 WebKit 既不肯按 <a download> 下载 (主框架会带着 download 意图导航到 blob: URL,整个界面被文件内容顶掉),也没暴露 WKDownload 的落点代理(拿不到保存位置,WKNavigationActionPolicyDownload 等于空转)。 前端因此「点生成文件不下载,界面变成文本」,聊天产物、知识库导出、群聊日志、对话 日志、渠道附件下载全都中招。 - 壳里注册 WKScriptMessageHandler:页面用 begin/chunk/end 把字节推给原生,原生弹 保存面板后写盘,再把 saved/cancelled/error 结果回传页面 - WKWebView 改用 WKWebViewConfiguration 创建以挂上该桥接;缺能力时自动退回原路径 - 文件名在原生侧清洗(去路径分隔符与控制字符、限长),并限制单文件大小与并发数 - 新增 frontend-enterprise/src/lib/download.ts 统一封装:有桥接走原生保存,浏览器里 保持原 <a download> 行为;对象 URL 延后回收,避免字节被提前释放 - 五个下载入口改用该封装,并按真实结果提示(用户取消保存面板不再谎报成功)
This branch has not been deployed
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.
打包态 macOS 壳把界面跑在 WKWebView 里,而本机 WebKit 既不肯按 下载 (主框架会带着 download 意图导航到 blob: URL,整个界面被文件内容顶掉),也没暴露 WKDownload 的落点代理(拿不到保存位置,WKNavigationActionPolicyDownload 等于空转)。 前端因此「点生成文件不下载,界面变成文本」,聊天产物、知识库导出、群聊日志、对话日志、渠道附件下载全都中招。