bug: [Web] CapacitorSQLite.getFromHTTPRequest resolves on 200 with empty body and “hangs” on 404
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- sqlite, typescript
调研方向
从 CapacitorSQLite.getFromHTTPRequest 的 Web 实现入手,复现 issue 中的两个 URL:带有空 body 的 200 响应,以及 404 响应。检查现有的 Web 行为以及任何相关的测试或入口点。当可访问的非 OK 响应和空 body 不再成功 resolve 或无限期等待时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Plugin version:
@capacitor-community/sqlite 7.0.0
Platform(s):
Web (tested on Chrome 139, Windows 10).
(App works differently on native; issue appears specific to Web.)
Current behavior:
- When the URL returns HTTP 200 with an empty body (e.g.,
Content-Length: 0),CapacitorSQLite.getFromHTTPRequest(options)resolves without error even though nothing is downloaded/imported. - When the URL returns HTTP 404, the Promise neither resolves nor rejects (appears to hang/freezes), leaving the caller waiting indefinitely.
Expected behavior:
- On non-OK responses (e.g., 404), the Promise should reject with a meaningful error (e.g.,
HTTP 404). - On 200 with empty body (
Content-Length: 0orblob.size === 0), the Promise should reject (e.g.,Empty response body) because there is nothing to import. - Ideally, minimal content validation (when expecting a DB/ZIP) should prevent a false positive “success.”
Steps to reproduce:
- Run the app on Web (not installed PWA).
- Call
getFromHTTPRequestwith a URL that returns 200 but empty body, e.g.https://httpbin.org/bytes/0. - Call it again with a URL that returns 404, e.g.
https://httpbin.org/status/404. - Observe that the first call resolves “success” despite no data; the second call never resolves or rejects.
Related code:
import { CapacitorSQLite, capSQLiteHTTPOptions } from '@capacitor-community/sqlite';
async function test(url: string) {
const options: capSQLiteHTTPOptions = {
url,
overwrite: true,
};
console.time(url);
try {
await CapacitorSQLite.getFromHTTPRequest(options);
console.log('RESOLVED (unexpected if empty body or 404):', url);
} catch (err) {
console.error('REJECTED (expected on HTTP errors or empty body):', url, err);
} finally {
console.timeEnd(url);
}
}
// A) 200 with empty body
test('https://httpbin.org/bytes/0'); // 200 OK, Content-Length: 0
// B) 404
test('https://httpbin.org/status/404'); // 404 Not Found
Other information:
- Browser: Chrome 139 on Windows 10.
- Framework: Ionic/Angular [please fill].
- Repro was done “from web”; not an installed PWA.
- With generic pages that return 200 but not a valid DB/ZIP (e.g.,
https://www.google.com), the call can also resolve, suggesting missing content validation on Web. - CORS: endpoints with CORS disabled correctly throw CORS errors (unrelated); the bug here is about reachable URLs returning 200/404.
- Likely Web-only:
fetchdoesn’t throw on 404 (ok === false), so explicit handling and/or a timeout/AbortControllermight be missing in the Web implementation.
- 主要语言
- Swift
- 星标
- 664
- 派生
- 159
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
capacitor-community/sqlite 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 72/100
capacitor-community/sqlite#700 · 1 条评论 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 25/100
capacitor-community/sqlite#693 · 7 个 reaction ·
-
bug/fix needs: triage
难度 3/5 1-2 天 新手友好度 68/100
capacitor-community/sqlite#690 ·
-
feature needs: triage
难度 3/5 1-2 天 新手友好度 55/100
capacitor-community/sqlite#689 ·
-
bug/fix needs: triage
难度 3/5 1-2 天 新手友好度 45/100
capacitor-community/sqlite#685 ·
查看 capacitor-community/sqlite 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 77/100
manaflow-ai/cmux#25687 ·
维护者通常 1 天内回复
-
documentation ready
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
Double free in Ares.query when ares_query_dnsrec fails synchronously (regression in 0.8.0)可能已有人在做 @EnzoH8321 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
apple/swift-async-dns-resolver#90 · 2 条评论 ·
-
[Bug] Library write-failure banner cannot be dismissed or collapsed可能已有人在做 @JoeyWu-tech 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 62/100
deltachat/deltachat-ios#3411 · 1 个 reaction ·
维护者通常 1 天内回复