Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

bug: [Web] CapacitorSQLite.getFromHTTPRequest resolves on 200 with empty body and “hangs” on 404

Aperta
#656 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
Ambito
databases, web-dev

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

bug/fix needs: triage

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: 0 or blob.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:

  1. Run the app on Web (not installed PWA).
  2. Call getFromHTTPRequest with a URL that returns 200 but empty body, e.g. https://httpbin.org/bytes/0.
  3. Call it again with a URL that returns 404, e.g. https://httpbin.org/status/404.
  4. 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: fetch doesn’t throw on 404 (ok === false), so explicit handling and/or a timeout/AbortController might 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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di capacitor-community/sqlite

Tutte le issue di capacitor-community/sqlite

Issue simili

Altre issue su Swift

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.