Skip to content

Commit 8ade40f

Browse files
committed
fix: streamline content length parsing and error logging in DownloadManager
1 parent c45518a commit 8ade40f

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

lib/services/download_manager.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,7 @@ class DownloadManager {
562562

563563
int contentLength = 0;
564564
if (response.headers.value('content-length') != null) {
565-
contentLength =
566-
int.parse(response.headers.value('content-length')!);
565+
contentLength = int.parse(response.headers.value('content-length')!);
567566
}
568567

569568
int total = received + contentLength;
@@ -611,8 +610,7 @@ class DownloadManager {
611610
if (e is DioException && e.type == DioExceptionType.cancel) {
612611
rethrow;
613612
}
614-
_logger.error('Download stream error',
615-
tag: 'DownloadManager', error: e);
613+
_logger.error('Download stream error', tag: 'DownloadManager', error: e);
616614
return false;
617615
} finally {
618616
dio.close();

0 commit comments

Comments
 (0)