[MV2] 更新过时的 axios & webdav 包。webdav 代码同步至 MV3版本#1006
Merged
CodFrm merged 6 commits intoscriptscat:release/mv2from Nov 22, 2025
Merged
[MV2] 更新过时的 axios & webdav 包。webdav 代码同步至 MV3版本#1006CodFrm merged 6 commits intoscriptscat:release/mv2from
CodFrm merged 6 commits intoscriptscat:release/mv2from
Conversation
43feb0e to
a62cc13
Compare
Member
|
虽然我是不太建议对mv2做太大改动的,怕出问题需要继续处理,不过你乐意就好 |
Contributor
There was a problem hiding this comment.
Pull request overview
这个PR主要是为MV2版本更新过时的依赖包,并将WebDAV相关代码同步到MV3版本的实现:
- 将 axios 从 1.4.0 升级到 1.13.2 以修复安全漏洞
- 将 webdav 从 4.11.0 升级到 5.8.0,webdav 5.x 版本从 axios 迁移到了 fetch API
- 重构了 WebDAV 代码以使用更简洁的 async/await 模式,移除了不必要的 Promise 包装
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | 更新 axios 到 1.13.2 和 webdav 到 5.8.0 |
| package-lock.json | 依赖树更新,包含 webdav 5.x 的新依赖(@buttercup/fetch、node-fetch 3.x 等) |
| pkg/filesystem/webdav/webdav.ts | 重构为更简洁的 async/await 模式,移除不必要的 Promise 包装,使用 for...of 替代 forEach |
| pkg/filesystem/webdav/rw.ts | 简化写入逻辑,改进错误处理 |
| jest.setup.js | 新增 global.fetch mock 以支持 webdav 5.x 在 Node 环境下的测试(存在 bug) |
| jest.config.js | 将 webdav 添加到 transformIgnorePatterns,配置 setupFilesAfterEnv |
| .eslintrc.cjs | 添加 no-continue 和 no-return-await 规则以便与 MV3 版本代码保持一致 |
Comment on lines
+19
to
+21
| return await (this.client.getFileContents(this.path, { | ||
| format: "text", | ||
| }) as Promise<string>; | ||
| }) as Promise<string>); |
There was a problem hiding this comment.
[nitpick] 不需要在外层添加 await,因为已经在返回一个 Promise。可以简化为:
return this.client.getFileContents(this.path, {
format: "text",
}) as Promise<string>;或者保留 await 但不需要额外的括号:
return await this.client.getFileContents(this.path, {
format: "text",
}) as Promise<string>;
Collaborator
Author
Collaborator
Author
不是大改动啦。 build 会直接出 critical issue |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
概述 Descriptions
1)webdav 太旧,以前里面用的 axois 有安全风险。
2)webdav 版本和相关代码都更新至 MV3版本
3)axois 的升级有看过官方文件跟问过AI。 API接口没改变。都是 fix & performance
4)为方便日后代码同步至MV3版本, eslint rules 加入「 "no-continue": "off" 及 "no-return-await": "off", 」
5)由于 webdav 5 从 axois 转到 fetch, 所以为了 node 环境 jest 通过,加入 global.fetch 的 mock
变更内容 Changes
截图 Screenshots