bfcadd() fails when checksum URL returns a non-404 error (e.g., HTTP 500)

未关闭 适合新手
#76 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
r
领域
backend

调研方向

从 BiocFileCache 的 R 源码中的 .verify_download_checksum() 开始,它通过 httr2 处理可选的 <url>.sha256 和 <url>.md5 请求。使用 bfcadd() 示例针对 miRBase URL 复现,然后将非 2xx 的校验和响应和请求错误改为表示“没有可用的校验和”,同时保留实际不匹配或部分下载的失败。完成意味着 GFF3 下载成功并给出消息/警告而不是中止,并且包的测试仍然通过。

由索引模型根据 Issue 内容生成。

描述

Description

Since 3.3.1 ("Check md5sum or sha if available"), .verify_download_checksum()
requests <url>.sha256 and <url>.md5 after a download. Only HTTP 404/410
are treated as "checksum not available"; any other non-2xx status raises an
error. That makes the whole download fail, and the resource is removed from
the cache.

Some servers return 5xx (or 403, etc.) for files that don't exist. miRBase
is one example:

https://www.mirbase.org/download/hsa.gff3         -> 200
https://www.mirbase.org/download/hsa.gff3.sha256  -> 500
https://www.mirbase.org/download/hsa.gff3.md5     -> 500

Reproducible example

library(BiocFileCache)
bfc <- BiocFileCache(tempfile(), ask = FALSE)
bfcadd(bfc, rname = "https://www.mirbase.org/download/hsa.gff3",
       rtype = "web", download = TRUE)
#> Error: bfcadd() failed; see warnings()
warnings()
#>   download failed
#>   web resource path: 'https://www.mirbase.org/download/hsa.gff3'
#>   ...
#>   reason: Could not retrieve sha256 checksum: HTTP 500

The file itself downloads fine (curl, download.file(), and BiocFileCache
before 3.3.1 all work).

Expected behavior

The checksum is optional ("if available"), so failing to retrieve one
should not abort a download that succeeded. Only an actual checksum
mismatch (or a partial download) should be an error. Suggested change: in
.verify_download_checksum(), treat any non-2xx status for the checksum URL,
and any request error (e.g., wrap req_perform() in tryCatch()), as "no
checksum available" and move on to the next algorithm, perhaps with a
message()/warning(), rather than calling stop().

This currently breaks downstream vignettes on the devel build (e.g., Bioc.gff,
which caches the miRBase GFF3 with bfcadd()).

Session info

  • BiocFileCache 3.3.2
  • httr2 1.3.0
  • R 4.6 / Bioconductor devel
主要语言
R
星标
14
派生
9
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Bioconductor/BiocFileCache 的其他 Issue

查看 Bioconductor/BiocFileCache 的全部 Issue

相似的 Issue

更多 R Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。