bug: [Web] CapacitorSQLite.getFromHTTPRequest resolves on 200 with empty body and “hangs” on 404
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- sqlite, typescript
Hướng nghiên cứu
Bắt đầu từ phần triển khai Web của CapacitorSQLite.getFromHTTPRequest và tái hiện hai URL được nêu trong issue: phản hồi 200 với body rỗng và phản hồi 404. Kiểm tra hành vi Web hiện có cùng mọi bài kiểm thử hoặc entry point liên quan. Công việc được hoàn tất khi các phản hồi non-OK có thể truy cập và các body rỗng không còn được resolve thành công hoặc chờ vô thời hạn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Swift
- Star
- 663
- Fork
- 159
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của capacitor-community/sqlite
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
capacitor-community/sqlite#700 · 1 bình luận · 1 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
capacitor-community/sqlite#693 · 7 reaction ·
-
bug/fix needs: triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
capacitor-community/sqlite#690 ·
-
feature needs: triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
capacitor-community/sqlite#689 ·
-
bug/fix needs: triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
capacitor-community/sqlite#685 ·
Tất cả issue của capacitor-community/sqlite
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
permissionlesstech/bitchat#1743 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
521xueweihan/HelloGitHub#3816 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
jamesmontemagno/tiny-clips#378 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
图标看起来比其他应用小一圈Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100