High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(mobile): do not continue on remote stream parse error (#18344)
shenlong9771e480492d
diff --git a/mobile/lib/infrastructure/repositories/sync_api.repository.dart b/mobile/lib/infrastructure/repositories/sync_api.repository.dartindex dd1ea208ba..c69122335e 100644--- a/mobile/lib/infrastructure/repositories/sync_api.repository.dart+++ b/mobile/lib/infrastructure/repositories/sync_api.repository.dart@@ -25,7 +25,6 @@ class SyncApiRepository implements ISyncApiRepository {int batchSize = kSyncEventBatchSize,http.Client? httpClient,}) async {- // ignore: avoid-unused-assignmentfinal stopwatch = Stopwatch()..start();final client = httpClient ?? http.Client();final endpoint = "${_api.apiClient.basePath}/sync/stream";@@ -98,7 +97,7 @@ class SyncApiRepository implements ISyncApiRepository {await onData(_parseLines(lines), abort);}} catch (error, stack) {- _logger.severe("error processing stream", error, stack);+ _logger.severe("Error processing stream", error, stack);return Future.error(error, stack);} finally {client.close();@@ -112,21 +111,17 @@ class SyncApiRepository implements ISyncApiRepository {final List<SyncEvent> data = [];for (final line in lines) {- try {- final jsonData = jsonDecode(line);- final type = SyncEntityType.fromJson(jsonData['type'])!;- final dataJson = jsonData['data'];- final ack = jsonData['ack'];- final converter = _kResponseMap[type];- if (converter == null) {- _logger.warning("[_parseSyncResponse] Unknown type $type");- continue;- }-- data.add(SyncEvent(type: type, data: converter(dataJson), ack: ack));- } catch (error, stack) {- _logger.severe("[_parseSyncResponse] Error parsing json", error, stack);+ final jsonData = jsonDecode(line);+ final type = SyncEntityType.fromJson(jsonData['type'])!;+ final dataJson = jsonData['data'];+ final ack = jsonData['ack'];+ final converter = _kResponseMap[type];+ if (converter == null) {+ _logger.warning("Unknown type $type");+ continue;}++ data.add(SyncEvent(type: type, data: converter(dataJson), ack: ack));}return data;