bug: [Web] CapacitorSQLite.getFromHTTPRequest resolves on 200 with empty body and “hangs” on 404
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- sqlite, typescript
Direzione di ricerca
Inizia dall’implementazione Web di CapacitorSQLite.getFromHTTPRequest e riproduci i due URL indicati nell’issue: la risposta 200 con un body vuoto e la risposta 404. Verifica il comportamento Web esistente e gli eventuali test o entry point correlati. Il lavoro è completato quando le risposte non-OK raggiungibili e i body vuoti non vengono più risolti con successo né restano in attesa indefinitamente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Swift
- Stelle
- 661
- Fork
- 158
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di capacitor-community/sqlite
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
capacitor-community/sqlite#700 · 1 commento · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
capacitor-community/sqlite#693 · 7 reazioni ·
-
bug/fix needs: triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
capacitor-community/sqlite#690 ·
-
feature needs: triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
capacitor-community/sqlite#689 ·
-
bug/fix needs: triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
capacitor-community/sqlite#685 ·
Tutte le issue di capacitor-community/sqlite
Issue simili
-
auth type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
googleapis/google-cloud-swift#1260 ·
I maintainer di solito rispondono entro 1 giorno
-
catalog-audit
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
0. Needs triage bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
clawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
steipete/RepoBar#140 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
area:dictation bug P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
uttrflow/uttrflow-swift#2551 ·
I maintainer di solito rispondono entro 1 giorno