Conversation
mkitsdts
approved these changes
May 19, 2026
Contributor
|
不好意思佬,之前疏忽了 |
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.
fix(189pc): handle numeric res_code in RenameResp to fix JSON unmarshal error
Description / 描述
修复 189pc(天翼云盘)驱动在重命名(Rename)接口中,因服务端
res_code字段返回数字类型导致 JSON 反序列化失败的问题。drivers/189pc/types.go中RenameResp.ResCode字段类型由string修改为any,使其能够兼容服务端返回的数字与字符串两种格式(与同文件中已有的RespErr.ResCode处理方式保持一致)。drivers/189pc/driver.go中对ResCode的字符串比较逻辑,先做类型断言再判断"FileAlreadyExists",避免类型不匹配同时保持原有错误映射行为。变更点
drivers/189pc/types.go:drivers/189pc/driver.go:Motivation and Context / 背景
线上日志中频繁出现以下报错,导致 189pc 重命名请求被 resty 重试并最终失败:
天翼云盘的
rename接口中,res_code字段在不同业务场景下返回类型不一致:0)"FileAlreadyExists")而原
RenameResp.ResCode被声明为string,遇到数字返回值时反序列化直接失败,触发重试与错误日志。实际上同一文件内的
RespErr.ResCode早已使用any处理类似情况(注释为居然有四种返回方式),本次修复将RenameResp对齐到该方案。Relates to #XXXX
How Has This Been Tested? / 测试
res_code为数字,JSON 反序列化正常,操作成功,错误日志消失。res_code为"FileAlreadyExists",类型断言命中,返回errs.ObjectAlreadyExists,行为与修复前保持一致。Checklist / 检查清单
我已阅读 CONTRIBUTING 文档。
go fmtor prettier.我已使用
go fmt或 prettier 格式化提交的代码。我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
我已相应更新了相关仓库(若适用)。