Skip to content

Commit 8b3c9a7

Browse files
authored
Merge pull request #1939 from tursodatabase/fix-empty-sync
libsql: Fix sync panic when remote database is empty
2 parents 016bea4 + 98a36fd commit 8b3c9a7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libsql/src/sync.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,9 @@ impl SyncContext {
281281
.map_err(SyncError::HttpBody)?;
282282
return Ok(PullResult::Frame(frame));
283283
}
284-
if res.status() == StatusCode::BAD_REQUEST {
284+
// BUG ALERT: The server returns a 500 error if the remote database is empty.
285+
// This is a bug and should be fixed.
286+
if res.status() == StatusCode::BAD_REQUEST || res.status() == StatusCode::INTERNAL_SERVER_ERROR {
285287
let res_body = hyper::body::to_bytes(res.into_body())
286288
.await
287289
.map_err(SyncError::HttpBody)?;

0 commit comments

Comments
 (0)