已开启
fix: 修复下载pdf时getFilePath非法路径的处理;对@ohos.request的request.downloadFile不支持大写scheme(HTTP://)URL的情况,做规范化处理 #33
fix: 修复下载pdf时getFilePath非法路径的处理;对@ohos.request的request.downloadFile不支持大写scheme(HTTP://)URL的情况,做规范化处理 #33
已开启
mazheng创建于 6 天前
mazheng
6 天前

fix: 修复下载pdf时getFilePath非法路径的处理;对@ohos.request的request.downloadFile不支持大写scheme(HTTP://)URL的情况,做规范化处理

likedislike
合并受阻
openharmony_ci
openharmony_ci成员
6 天前 评论:

感谢提交 Pull Requests !此PR未通过DCO校验。
校验失败可能原因:

1. 未签署“DCO协议”(开发者原创声明协议),在线签署、查看签署状态

2. Commits 中未包含 Signed-off-by信息,参考FAQ处理

修复上述问题后,在PR的评论框输入“check dco” ,单击”评论”,系统将再次进行DCO校验。

当前检测到如下Commits 未包含Signed-off-by信息:


Thanks for submitting a pull request. This pull request has not passed the DCO check.
Possible causes:

1. You have not signed the Developer Certificate of Origin (DCO). Sign the DCO and check DCO status.

2. The commits do not contain the Signed-off-by information. To resolve this issue, see FAQs.

After resolving the preceding issues, enter check dco in the comment box of this pull request and click Comment. The system will check DCO status again.

The following commits do not contain the Signed-off-by information:

likedislike
openharmony_ciopenharmony_ci成员
6 天前 添加了label:dco检查失败
cpf-manager
cpf-manager6 天前进行代码检视2
harmony/doc-viewer/src/main/ets/turborModules.ts
已过期
@@ -154,3 +174,3 @@
154174 downloadTask.on('complete', () => {
155175 Log.debug(`download complete:${fileName}`)
156- this.shareFile(filePath, fileType, callback)
176+ try {
cpf-manager
cpf-manager6 天前评论:

【AI-Review】【建议】【软件设计】【冗余重复代码】download complete 回调中的 try/catch 与 shareFile 内部 try/catch 重复

● 问题: 在 download 方法的 downloadTask.on('complete', ...) 回调中(turborModules.ts:176-181),新增的 try/catch 包裹了 this.shareFile(filePath, fileType, callback) 调用。但本 PR 同时给 shareFile 方法(turborModules.ts:202-211)也加上了 try/catch,其 catch 块已经会调用 callback(shareFile err:${JSON.stringify(e)}) 将错误传回。由于 shareFile 是同步函数且其整个方法体都在 try 内,同步异常已被 shareFile 自身捕获并消化,不会再向外抛出,因此 complete 回调里的 catch 分支在正常路径下不可达,属于冗余代码。

触发路径: downloadTask 'complete' 事件触发 → this.shareFile(filePath, fileType, callback) 执行 → shareFile 内部 try 块(fileUri.getUriFromPath 或 this.start)抛出同步异常 → shareFile 的 catch 捕获并调用 callback(shareFile err:...) → shareFile 正常返回(未向外抛出)→ complete 回调的 try 块未捕获到任何异常 → complete 回调的 catch 分支(179-180 行)不可达。

● 影响: 一般。正常路径下 catch 块为死代码,影响可维护性;在 shareFile 的 catch 块自身抛出异常的边缘场景下(例如 callback 回调本身 throw),外层 catch 会再次调用 callback(download complete err:...),导致 callback 被重复调用两次(先由 shareFile 的 catch 调用一次,再由 complete 回调的 catch 调用一次)。

● 建议: 二选一:

  1. 移除 complete 回调中冗余的 try/catch,直接调用 this.shareFile(filePath, fileType, callback);
  2. 或保留外层 try/catch 作为防御性兜底,但需确认与 shareFile 内部 catch 的职责边界,避免对同一 callback 重复触发错误回调。
likedislike
System
系统消息系统
6 天前 评论:

changed this line on 4dc49f5c view diff detail

Mmazheng
6 天前 强制推送  1 个提交:4dc49f5c-fix: 修复下载pdf时getFilePath非法路径的处理;对@ohos.request的request.downloadFile不支持大写scheme(HTTP://)URL的情况,做规范化处理
openharmony_ci
openharmony_ci成员
6 天前 评论:

感谢提交 Pull Requests !此PR未通过DCO校验。
校验失败可能原因:

1. 未签署“DCO协议”(开发者原创声明协议),在线签署、查看签署状态

2. Commits 中未包含 Signed-off-by信息,参考FAQ处理

修复上述问题后,在PR的评论框输入“check dco” ,单击”评论”,系统将再次进行DCO校验。

当前检测到如下Commits 未包含Signed-off-by信息:


Thanks for submitting a pull request. This pull request has not passed the DCO check.
Possible causes:

1. You have not signed the Developer Certificate of Origin (DCO). Sign the DCO and check DCO status.

2. The commits do not contain the Signed-off-by information. To resolve this issue, see FAQs.

After resolving the preceding issues, enter check dco in the comment box of this pull request and click Comment. The system will check DCO status again.

The following commits do not contain the Signed-off-by information:

likedislike
此处折叠了103条消息 查看更多
openharmony_ciopenharmony_ci成员
3 天前 添加了label:编译成功
openharmony_ciopenharmony_ci成员
3 天前 添加了label:静态检查成功
openharmony_ciopenharmony_ci成员
3 天前 通过测试
openharmony_ci
openharmony_ci成员
3 天前 评论:

代码门禁通过
您可以通过如下链接查看门禁报告:http://dcp.openharmony.cn/workbench/cicd/detail/6a9a3a3264650f998ba09ddf/runlist

静态检查:

# check type result report
1 codeCheck pass >>>

编译测试:
# Device build result package
1 rntpc_br_rnoh0.77 success >>>

likedislike
openharmony_dcp
openharmony_dcp成员
3 天前 评论:

你因提交次数过多被限制提交,为保障上库效率、避免资源浪费,请先观看学习视频:https://dcp.openharmony.cn/workbench/video/videoDisplay

likedislike